Date: Tue, 31 May 2016 16:25:22 +0300 From: Andrey Chernov <ache@freebsd.org> To: Bruce Evans <brde@optusnet.com.au> Cc: pfg@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r300956 - head/lib/libc/stdlib Message-ID: <92189e8c-8434-9b54-acf9-9909e647a0db@freebsd.org> In-Reply-To: <dfce72b3-3f49-1d82-fc8b-7bccae57ade6@freebsd.org> References: <201605291357.u4TDv6No071840@repo.freebsd.org> <20160530110541.I924@besplex.bde.org> <b7074832-ba30-0371-ee8a-a51a19aadea0@freebsd.org> <20160531155327.I1534@besplex.bde.org> <af15ef04-74f5-6a02-9822-2cacaa7ded1b@freebsd.org> <20160531185907.Y2047@besplex.bde.org> <dfce72b3-3f49-1d82-fc8b-7bccae57ade6@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
This implementation of shifts&xors 32-bit and 64-bit PRNGs looks more reliable than Mersenne primes and don't use Bignums: http://wwwmaths.anu.edu.au/~brent/ftp/random/xorgens305.tar.gz PDF article inside. On 31.05.2016 14:30, Andrey Chernov wrote: > On 31.05.2016 12:58, Bruce Evans wrote: >> On Tue, 31 May 2016, Andrey Chernov wrote: >> >>> On 31.05.2016 9:48, Bruce Evans wrote: >>>>> Perhaps you can find some ideas, answers and PRNG comparison in the >>>>> original paper: >>>>> http://www.firstpr.com.au/dsp/rand31/p1192-park.pdf >>>> >>>> The ones with Mersenne primes and tweaked Mersenne primes in the >>>> reference >>>> (lanl?) given by pfg@ seem OK. >>> >>> It should be again correctly implemented to not overflow 64bit (as any >>> other 64bit generator too). >>> >>> Moreover, it have visible patterns in the low order bits. This one from >>> the same site is better >>> http://nuclear.llnl.gov/CNP/rng/rngman/node7.html >>> but still have some pattern too and 61-bit. Next one does not suffer >>> from the pattern at all >>> http://nuclear.llnl.gov/CNP/rng/rngman/node8.html >>> but is 2^64-2^10+1. >> >> That's the tweaked Mersenne prime one. >> >> Surely there is a pattern in the bits for all of these, and the better >> ones just hide the pattern better from normal uses and tests? > > Excepting bad first one from pfg@ > http://nuclear.llnl.gov/CNP/rng/rngman/node4.html > as I understand, they not hide (i.e. drop) the pattern but mix it with > other part in calculations, it cause whole range reduced. > >>> You can download SPRNG library implementing all of them here: >>> http://www.sprng.org/RNG/ >>> For me it is overcomplicated. >> >> The general case is certainly too complicated. It would let the user >> specify all the parameters for the LCG and generate optimal code for >> the choice on the fly. Maybe also change the parameters with the seed. >> But even most implementors don't know how to choose the parameters. >> That's just for the not so good LCG family of RNGs. > > All mentioned PRNGs with exact parameters (info.h) can be found in the > subdirs under SRC, f.e. lcg64 or pmlcfg. They are still looks > complicated and use GMP Bignum library for calculations.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?92189e8c-8434-9b54-acf9-9909e647a0db>