Hi
On 6/17/22 19:28, Go Kudo wrote
I don't think that ->pickString() is a good name
I see. But I think `randomString()` is ambiguous with `getBytes()`.
`stringFromCharset(string $string, int $num): string` solves that, but I
think it is possible
that the meaning of "char" is not well known in the PHP world (although I
think this name is most appropriate)
->stringFromAlphabet()?
How about adding an optional `?int $num` argument to `shuffleString(string
$string, ?int $num): string`?
No, because it would be pretty unclear what that `$num` argument would
do there. It specifically would be different from the `$num` of
`pickArrayKey()`. pickArrayKey() returns every key only once. Generating
a string from a given charset may return the same character multiple
times. Don't overload a single method with too many purposes.
Best regards
Tim Düsterhus
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php