[erlang-questions] Implementation of a 2006 version of Wichmann-Hill random number generator for Erlang/OTP

Robert Virding <>
Tue Nov 30 23:50:35 CET 2010


What would be nice is if we could just drop the new algorithm into the old module so we avoid having to have 2 random modules. As I see it the main problem is that the old random has 3 seeds while the new has 4, which makes the seed functions incompatible. Couldn't you just have one seed be two?

It would mean that the "new" random would return better values, but they would be different from what the "old" random returned. I don't see this as a problem but others might.

Robert

----- "Kenji Rikitake" <> wrote:

> The fix looks much better.  I'll put it in the gist.
> (BTW gist is a git archive itself so you can fork by yourself)
> Kenji Rikitake
> 
> In the message <>
> dated Thu, Nov 25, 2010 at 11:34:48AM +1300,
> Richard O'Keefe <> writes:
> > On 24/11/2010, at 6:11 PM, Kenji Rikitake wrote:
> > 
> > > The 2006 Wichmann-Hill RNG for Erlang moved to
> > > https://gist.github.com/713144
> > > under the name of
> > > random_wh06.erl
> > 
> > Didn't we just have a discussion about not allowing zeros?
> > Shouldn't seed/4 be
> > 
> > seed(A1, A2, A3, A4) ->
> >     put(random_wh06_seed, 
> > 	{abs(A1) rem 2147483578 + 1,
> > 	 abs(A2) rem 2147483542 + 1, 
> > 	 abs(A3) rem 2147483422 + 1,
> > 	 abs(A4) rem 2147483122 + 1}).
> > 
> > Or did I misunderstand?
> 
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:


More information about the erlang-questions mailing list