[erlang-questions] more random uniform

Bengt Kleberg bengt.kleberg@REDACTED
Sun Oct 27 11:48:28 CET 2013


7> [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


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


----- Ursprungligt meddelande -----
Från: Bengt Kleberg <bengt.kleberg@REDACTED>
Till: null
Kopia: "erlang-questions@REDACTED" <erlang-questions@REDACTED>
Skickat: 27-10-2013 11:33 fm
Ämne: Re: [erlang-questions] more random uniform




Thank you.

I have 15B.
Is the erase/1 necessary? I am using new processes each time.


Bengt

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


----- Ursprungligt meddelande -----
Från: Tony Rogvall <tony@REDACTED>
Till: Bengt Kleberg <bengt.kleberg@REDACTED>
Kopia: "erlang-questions@REDACTED" <erlang-questions@REDACTED>
Skickat: 27-10-2013 11:13 fm
Ämne: Re: [erlang-questions] more random uniform




I can not replicate this (on R16B01).

> erase(random_seed), random:seed(erlang:now()), random:uniform(3).
1
> erase(random_seed), random:seed(erlang:now()), random:uniform(3).
2
...

?

/Tony


On 27 okt 2013, at 10:45, Bengt Kleberg <bengt.kleberg@REDACTED<mailto:bengt.kleberg@REDACTED>> wrote:

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-questions@REDACTED<mailto:erlang-questions@REDACTED>
http://erlang.org/mailman/listinfo/erlang-questions

"Installing applications can lead to corruption over time. Applications gradually write over each other's libraries, partial upgrades occur, user and system errors happen, and minute changes may be unnoticeable and difficult to fix"



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20131027/5aecc751/attachment.htm>


More information about the erlang-questions mailing list