note 39306 deleted from function.rand by nlopess
| From: | nlopess@php.net | Date: | Sat, 24 Jan 2004 10:09:14 +0000 |
| Subject: | note 39306 deleted from function.rand by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-64103@lists.php.net to get a copy of this message | ||
Note Submitter: cesoid@yahoo.com
----
Note that md5() does not make a random number any more likely to be unique. md5() is a deterministic
function, meaning md5(x) == md5(x) for any value of x. If it didn't work that way, it
wouldn't do things that it is supposed to do, like encode the same password at two different
times and create the same two results.
In the same way, md5(rand())will give you the same result if, by chance, the same random number
comes out of rand(). Also md5(time()) will generate the same result if it is executed twice in the
same second (ie time() gives the same result). The only result of running these things through md5
is to hide to original number, thus hiding, for example (for reasons I cannot imagine) that you are
using the time, or possibly the range of your selection of random numbers.