[erlang-questions] process dictionary, anyone?

Luke Gorrie <>
Fri Apr 27 10:10:55 CEST 2007


Robert Virding <> writes:

> I don't want to say it but RTFM. It's documented as well as how you 
> initialise the seed. The algorithm used is quite good but not at all 
> suitable for cryptography.

Since you did say it :-) I checked TFM and it's not helpful.

Most people calling random:uniform/1 will want a randomish number,
like e.g. 'head -c 1 /dev/random' on Linux. This should be easy.

TFM doesn't explain how to do this. If you read carefully you see that
you need to provide your own seed but there's no hint how to get one.

Here is the way I've learned to get a "random enough that the
programmer can't guess the answer" number:

  {A,B,C} = now(),
  random:seed(A,B,C),
  random:uniform(N)

but that's from grep'ing around to see how Tony and Klacke do it.

Possibly the referenced article in the 1982 Journal of Applied
Statistics has an excellent explanation of how to produce your own
seed and virtue of the constant provided by seed0(), but seriously!





More information about the erlang-questions mailing list