<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<pre style="word-wrap:break-word; font-size:10.0pt; font-family:Tahoma; color:black">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@gmail.com>
Till: "erlang-programming@googlegroups.com" <erlang-programming@googlegroups.com>
Kopia: "erlang-questions@erlang.org" <erlang-questions@erlang.org>, Bengt Kleberg <bengt.kleberg@ericsson.com>
Skickat: 27-10-2013 4:35 em
Ämne: Re: [erlang-questions] more random uniform
</pre>
<div>
<div dir="ltr">
<div>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)]. </div>
<div>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 </div>
<div><br>
</div>
<div>BUT (now() instead of X, y, 0)</div>
<div><br>
</div>
<div>
<div>2> [erlang:spawn( fun() -> random:seed(now()), io:fwrite("~p ", [random:uniform(3)]) end ) || X<-lists:seq(1,10), Y<-lists:seq(1,10)]. </div>
<div>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 </div>
</div>
<div><br>
</div>
<div><br>
</div>
<br>
воскресенье, 27 октября 2013 г., 13:45:35 UTC+4 пользователь Bengt Kleberg написал:
<blockquote class="gmail_quote" style="margin:0; margin-left:0.8ex; border-left:1px #ccc solid; padding-left:1ex">
Greetings, <br>
<br>
When doing random:uniform/1 for small values, ie 3, the result is 1 the first time. Changing the seed does not help.
<br>
What am I missing? <br>
<br>
<br>
Bengt <br>
<br>
Sent from Moxier Mail <br>
(<a href="http://www.moxier.com" target="_blank">http://www.moxier.com</a>) <br>
______________________________<wbr>_________________ <br>
erlang-questions mailing list <br>
<a href="" target="_blank">erlang-q...@erlang.org</a> <br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/<wbr>listinfo/erlang-questions</a>
<br>
</blockquote>
</div>
</div>
</body>
</html>