Re: Really random ?
| From: | Stefan Walk | Date: | Wed, 04 Mar 2009 15:28:49 +0000 |
| Subject: | Re: Really random ? | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-43253@lists.php.net to get a copy of this message | ||
On 4 Mar 2009, at 15:46, Kenan Sulayman wrote:
Hey Pierre! Didn't I included the mt_rand function in my tests ? Quote: "Average of mersenne twister in 8016909 it's is 1073848211.4106 ( corresponding to that in 8503575 it's the avg. is 1073904131.0286)." The mail was meant to make the rand(x) function more good; I already use the mt_rand() function, but why should the rand(x) function still be used, if it's so freakin' insecure ?I hope that by "insecure" you don't imply that you're using those pseudorandom generators for cryptography purposes. As the manual states, rand() uses the libc rand(), which can be desirable if you want to generate the same sequence of numbers across languages. And you don't need to complain about its drawbacks, because they are well-known (see <http://en.wikipedia.org/wiki/Linear_congruential_generator#Advantages_and_disadvantages_of_LCGs
). If you want "secure" random numbers, use something that at least tries to utilize "real" entropy. But that topic has nothing to do with the development of PHP ...Regards, Stefan