Re: Re: rand_str
| From: | Jeroen van Wolffelaar | Date: | Sun, 05 Aug 2001 19:53:04 +0000 |
| Subject: | Re: Re: rand_str | ||
| References: | 1 2 3 4 5 6 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-62172@lists.php.net to get a copy of this message | ||
> Hi Jeroen,
>
> I think we're not on the same page. :) I consider both versions
> of str_rand() I posted trivial...
Agree. But they are not what rand_str could do. The result has
16 different chars, just because md5 happens to have that much.
Implementing something that has NOT that limitation, is far less trivial.
Below is a - limited - implementation
> Also, and this is strictly subjective, I don't think the function
> needs to be implemented natively. As I said, it's trivial. :) But
> my stance could be rated as -0.3... Actually, as I'm thinking about
> it, -0.2.
k, mine is 0.8, 0.9, on the idea, not the details
> as for the rand_str($len , "1..9a..f\x4F") proto:
> I don't like it. KISS.
Better suggestions? Simple length and a list of characters... and the
list-of-characters way is also in addcslashes, and the trims.
Jeroen