← Back to team overview

yade-users team mailing list archive

Re: [Question #253257]: generate a random number in the C++ code

 

Question #253257 on Yade changed:
https://answers.launchpad.net/yade/+question/253257

Raphaël Maurin posted a new comment:
Thank you for your replies.

I just had a quick look at a review about random number generator in the
chapter 7 of [1]. It is very interesting, and well detailed. They
underline the fact that some usual generator proposed can be pretty bad,
because the parametrization of the generators can be very important for
the randomness.

In my case, the random number generation is important but not crucial so
I am not looking for something perfect but good enough.  It seems that
the linear congruential generators, as the one you use Klaus are adapted
to my use. The parametrization the generators  minstd_rand0 proposed in
boost library (variation of the one you are using : minstd_rand) is
based on the parametrization proposed by Park and Miller, which is cited
as an efficient parametrization by [1]. It is described as a "a good
minimal standard" random number generator.

For people interested in more efficient generator, I think it is worth
having a look at [1].

One last question Klaus, how did you test the random number generator
exactly ?

Thank you all for the help !

Raphaël


[1] p.274 Numerical Recipes in C: The Art of Scientific Computing, Second Edition, William H. Press, Brian P. Flannery, Saul A. Teukolsky, William T. Vetterling. (1992)
http://www2.units.it/ipl/students_area/imm2/files/Numerical_Recipes.pdf

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.