Seeding the pseudo random number generator

Einar Karttunen ekarttun@REDACTED
Thu Jun 3 23:18:32 CEST 2004


Is there a way to automatically seed the pseudo random number generator?
Using random:uniform I get allways the same sequence of numbers. I could
allways seed the generator when my module is called but that does not 
seem a good idea... And what is the preferred way of seeding the 
generator? Using erlang:now seems the easiest approach, but the
generated numbers are not random by any means.

seed() ->
	{A,B,C} = erlang:now(),
Using /dev/urandom seems possible, but I would like to avoid it if

- Einar Karttunen

More information about the erlang-questions mailing list