note 52335 added to function.rand
| From: | cezden at osu1 dot php dot net | Date: | Thu, 28 Apr 2005 08:30:00 +0000 |
| Subject: | note 52335 added to function.rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-88673@lists.php.net to get a copy of this message | ||
Jawsper,
the problem is that in your method you get not more than
RAND_MAX
'random' strings. (in fact they are not random in the set of all strings of given length)
It's rather poor result when compared with goochivasquez's
strlen($keychars)^$length
number of strings.
In other words - it's little bit less complicated but far, far from achieving the goal.
cezden
----
Manual Page -- http://www.php.net/manual/en/function.rand.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+52335
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52335&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52335&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52335&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52335&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52335&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+52335&report=yes
Search -- http://master.php.net/manage/user-notes.php