[erlang-questions] Erlang random number generator weak?

mats cronqvist <>
Wed Nov 12 21:04:00 CET 2008


"Adam Kelly" <> writes:


> So, is it an accepted fact that two processes started at almost the
> same time will produce highly correlated random sequences?

  not afaik.

  but i think it is (possibly un-)common knowledge that given very
  similar seeds, two sequences will start out similarly.

  the mess below shows the 10:th element of 10 sequences with similar
  seeds. the sequences diverges pretty rapidly.

  mats

1> L10=lists:seq(1,10).
2> [(fun()->random:seed(1,2,N), hd(lists:reverse([random:uniform(1000)||_<-L10])) end)() || N <- L10].

 [96,449,802,154,507,859,212,565,917,270]




More information about the erlang-questions mailing list