[erlang-questions] more random uniform

Bengt Kleberg bengt.kleberg@REDACTED
Sun Oct 27 17:28:24 CET 2013


My computer is not available right now, but my understanding is that using now() will make it really hard to reproduce that sequence again.



Bengt


Sent from Moxier Mail
(http://www.moxier.com)


----- Ursprungligt meddelande -----
Från: Evgeny M <donpedrothird@REDACTED>
Till: "erlang-programming@REDACTED" <erlang-programming@REDACTED>
Kopia: "erlang-questions@REDACTED" <erlang-questions@REDACTED>, Bengt Kleberg <bengt.kleberg@REDACTED>
Skickat: 27-10-2013 4:35 em
Ämne: Re: [erlang-questions] more random uniform




1>  [erlang:spawn( fun() -> random:seed(X,Y,0), io:fwrite("~p ", [random:uniform(3)]) end ) || X<-lists:seq(1,10), Y<-lists:seq(1,10)].
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

BUT (now() instead of X, y, 0)

2>  [erlang:spawn( fun() -> random:seed(now()), io:fwrite("~p ", [random:uniform(3)]) end ) || X<-lists:seq(1,10), Y<-lists:seq(1,10)].
1 3 3 2 3 1 2 1 2 3 1 3 1 2 1 3 3 1 1 3 2 1 2 1 3 1 3 2 3 2 3 2 3 1 2 3 2 3 1 2 3 2 1 3 1 2 1 2 1 1 1 1 2 2 3 1 2 3 1 3 2 1 2 3 2 1 3 1 2 1 3 3 2 2 1 3 3 1 2 1 2 2 2 1 1 2 3 2 3 1 2 3 1 3 1 2 3 2 3 2



воскресенье, 27 октября 2013 г., 13:45:35 UTC+4 пользователь Bengt Kleberg написал:
Greetings,

When doing random:uniform/1 for small values, ie 3, the result is 1 the first time. Changing the seed does not help.
What am I missing?


Bengt

Sent from Moxier Mail
(http://www.moxier.com)
_______________________________________________
erlang-questions mailing list
erlang-q...@REDACTED
http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20131027/e1b7472e/attachment.htm>


More information about the erlang-questions mailing list