Re: svn commit: r300956 - head/lib/libc/stdlib

2016-06-01 Thread Bruce Evans
On Tue, 31 May 2016, Chris Torek wrote: That was what I was complaining about. div.c is for C90 (misspelled "ANSI"). It wasn't misspelled when I wrote it. :-) The 1989 ANSI C :-) standard was formally ratified in Dec 1989, and the draft was pretty firm by the time I wrote the code

Re: svn commit: r300956 - head/lib/libc/stdlib

2016-05-31 Thread Chris Torek
>That was what I was complaining about. div.c is for C90 (misspelled >"ANSI"). It wasn't misspelled when I wrote it. :-) The 1989 ANSI C standard was formally ratified in Dec 1989, and the draft was pretty firm by the time I wrote the code (which I am sure was also 1989, despite the 1990

Re: svn commit: r300956 - head/lib/libc/stdlib

2016-05-31 Thread Andrey Chernov
On 31.05.2016 17:17, Bruce Evans wrote: > Our rand should use just 1, and it is dangerous to change RAND_MAX again, > but can we even change the sequences? Something might depend on > reproducing the old sequences. This question already arises many times. The sequence must be reproducible during

Re: svn commit: r300956 - head/lib/libc/stdlib

2016-05-31 Thread Bruce Evans
On Tue, 31 May 2016, Andrey Chernov wrote: On 31.05.2016 12:58, Bruce Evans wrote: On Tue, 31 May 2016, Andrey Chernov wrote: ... 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

Re: svn commit: r300956 - head/lib/libc/stdlib

2016-05-31 Thread Andrey Chernov
This implementation of shifts 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,

Re: svn commit: r300956 - head/lib/libc/stdlib

2016-05-31 Thread Andrey Chernov
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

Re: svn commit: r300956 - head/lib/libc/stdlib

2016-05-31 Thread Bruce Evans
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

Re: svn commit: r300956 - head/lib/libc/stdlib

2016-05-31 Thread Andrey Chernov
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.

Re: svn commit: r300956 - head/lib/libc/stdlib

2016-05-31 Thread Bruce Evans
On Mon, 30 May 2016, Andrey Chernov wrote: On 30.05.2016 5:17, Bruce Evans wrote: ... Even 1980's compiler technology was not far from reducing the division to a multiplication. The LCG expression would then reduce to (uintN_t)(A * x + B) where N is either 32 or 64. Perhaps N needs to be 64

Re: svn commit: r300956 - head/lib/libc/stdlib

2016-05-30 Thread Pedro Giffuni
(Interesting discussion) On 05/29/16 21:17, Bruce Evans wrote: On Sun, 29 May 2016, Andrey A. Chernov wrote: Log: 1) Unifdef USE_WEAK_SEEDING since it is too obsolete to support and makes reading hard. Good. 2) Instead of doing range transformation in each and every function here, do

Re: svn commit: r300956 - head/lib/libc/stdlib

2016-05-29 Thread Andrey Chernov
On 30.05.2016 5:17, Bruce Evans wrote: > On Sun, 29 May 2016, Andrey A. Chernov wrote: > >> Log: >> 1) Unifdef USE_WEAK_SEEDING since it is too obsolete to support and >> makes >> reading hard. > > Good. > >> 2) Instead of doing range transformation in each and every function >> here, >> do

Re: svn commit: r300956 - head/lib/libc/stdlib

2016-05-29 Thread Bruce Evans
On Sun, 29 May 2016, Andrey A. Chernov wrote: Log: 1) Unifdef USE_WEAK_SEEDING since it is too obsolete to support and makes reading hard. Good. 2) Instead of doing range transformation in each and every function here, do it single time directly in do_rand(). One "mod" operation

svn commit: r300956 - head/lib/libc/stdlib

2016-05-29 Thread Andrey A. Chernov
Author: ache Date: Sun May 29 13:57:06 2016 New Revision: 300956 URL: https://svnweb.freebsd.org/changeset/base/300956 Log: 1) Unifdef USE_WEAK_SEEDING since it is too obsolete to support and makes reading hard. 2) Instead of doing range transformation in each and every function here,