Re: [PATCH v3 0/3] automatically skip away from broken commits
- From
Jakub Narebski <jnareb@gmail.com>
- Date
- Jun 13, 2009, 19:35 UTC
- Message-ID
- <m3r5xo2ajc.fsf@localhost.localdomain>
- In-Reply-To
- <4A33F7E4.4020201@zytor.com>
"H. Peter Anvin" <hpa@zytor.com> writes:
> Christian Couder wrote: >> On Thu, Jun 11, 2009 at 7:05 AM, H. Peter Anvin<hpa@zytor.com> wrote:
Show 18 quoted lines
>> To implement the PRNG, I guess that using something based on the
>> function given by "man 3 rand" should be ok:
>>
>> int get_prn(int count) {
>> count = count * 1103515245 + 12345;
>> return((unsigned)(count/65536) % 32768);
>> }
>>
>> where the "count" we pass is the count of elements in the list rather
>> than the static seed.
>
> Yes, or perhaps better we could use some combination of the SHA-1s
> involved as seeds... they are rather nice for this as they are wide and
> much better PRNGs than most classical algorithms.
>
> The main problem with the above algorithm is that it only produces 16
> bits of output, which when biased can turn into a fairly significant
> granularity.Why not borrow one of algorithms, e.g. taus[1] from GSL (GNU Scientific Library)?
If I understand "Random Number Generator Performance" chapter in GSL Manual it is of comparable performance of the above BSD `rand` generator, and is of simulation quality.
[1] maximally equidistributed combined Tausworthe generator by L'Ecuyer
-- Jakub Narebski Poland ShadeHawk on #git