[erlang-questions] Erlang random number generator weak?
Thu Nov 20 03:45:13 CET 2008
On Nov 12, 2008, at 1:40 PM, Robert Virding wrote:
> Note that the number sequence from random is in fact quite good, it
> uses a good algorithm. *BUT* it is deterministic if you know one
> number/seed, so while it is perfectly ok for simulation and such, it
> is *NOT* safe to use for cryptographic purposes!
Actually, as Bob Ippolito pointed out, it's not good.
The suggested method for seeding the random # generator is with the
output of now/0. But it doesn't do that great a job. For instance:
Note that lines 9 and 14 use _different_ seeds, as might come out of
now/0. But the random generator still generates the same values.
Instead, use crypto. Bonus: no seeding required.
More information about the erlang-questions