[gmx-developers] Random number blues

Erik Lindahl erik.lindahl at gmail.com
Thu Apr 21 13:16:59 CEST 2016


Yes, two unfortunately (even for the simple stuff):

1) Avoiding buggy standard library implementations
2) Portability - the sequence of random numbers will depend on your standard library

I have no idea whether there _should_ be a unique definition for the algorithms used internally in C++11, but I tested a large number of implementations and the results differ a lot.
There are also bugs for some of the more specialized distributions (gamma) in a few implementations, so when I got to that point I simply decided we need our own known-good-and-portable version.

My recommendation would be to stick with this for everything, rather than trying to document, remember, and check where the standard library isn’t broken….



> On 21 Apr 2016, at 12:37, David van der Spoel <spoel at xray.bmc.uu.se> wrote:
> Hi,
> just finding out that gmx_rng_t has been replaced by C++.
> Is there any reason to use the new gromacs code rather than the C++11 built-in one for simple random numbers?
> http://en.cppreference.com/w/cpp/numeric/random/uniform_real_distribution
> -- 
> David van der Spoel, Ph.D., Professor of Biology
> Dept. of Cell & Molec. Biol., Uppsala University.
> Box 596, 75124 Uppsala, Sweden. Phone:	+46184714205.
> spoel at xray.bmc.uu.se    http://folding.bmc.uu.se
> -- 
> Gromacs Developers mailing list
> * Please search the archive at http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List before posting!
> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
> * For (un)subscribe requests visit
> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers or send a mail to gmx-developers-request at gromacs.org.

More information about the gromacs.org_gmx-developers mailing list