Re: Re: [RFC] [VOTE] Random Extension 5.x
| From: | Tim Düsterhus | Date: | Fri, 17 Jun 2022 17:37:35 +0000 |
| Subject: | Re: Re: [RFC] [VOTE] Random Extension 5.x | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-117989@lists.php.net to get a copy of this message | ||
Hi
On 6/17/22 19:28, Go Kudo wrote
->stringFromAlphabet()?I don't think that ->pickString() is a good nameI see. But I thinkrandomString()is ambiguous withgetBytes().stringFromCharset(string $string, int $num): stringsolves 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)
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