[erlang-questions] more random uniform

Evgeny M donpedrothird@REDACTED
Sun Oct 27 16:35:21 CET 2013


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 <javascript:> 
> http://erlang.org/mailman/listinfo/erlang-questions 
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20131027/41f65734/attachment.htm>


More information about the erlang-questions mailing list