commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luc Maisonobe <>
Subject Re: [math] new pseudo random number generators
Date Tue, 21 Sep 2010 08:30:32 GMT
Le 21/09/2010 10:08, Mikkel Meyer Andersen a écrit :
> 2010/9/21 Luc Maisonobe <>:
>> Le 21/09/2010 09:26, Mikkel Meyer Andersen a écrit :
>>>> Here is an extract from the answer from Pierre L'Ecuyer:
>>>>  Our code can be released under either a GPL or a commercial license.
>>> Well, what about the Apache License then?
>> It is their code and I did not use it. The main point is we
>> reimplemented it. Of course, relying on their code that is GPLed would
>> be a clear no-go as GPL is a category X license (see
>> <>).
> Exactly. But as I understood, you used some of their optimization
> principles - but that is not an issue or?

I finally inlined everything, yes but I doubt it would count as a
specific optimization found only in this original code. It's a common
way and especially when the code to be inlined is one or two
instructions only. The elementary transforms here are very simple
(things like "v0 ^ (v0 << 25)" or "((z2 & 0x00020000) != 0) ? (z2Prime ^
0xb729fcec) : z2Prime"). Inlining this is common sense.

>> Perhaps I should give a go to still other optimizations just to make
>> more clear our code is really different ?
> I'm not sure what you mean?

Some ways to optimize further could be to process several numbers in raw
to benefit from some of the values being already in register rather than
putting them in a memory array to read them back just the next iteration
(one Well iteration uses 5 values from the bits pool array, two being
close together and the three other being spread in the array).
Basically, it would be packing two or more iterations in one call and
cache the results. Then, when the user asks for 1 million numbers, some
calls would result in simply retrieving one value from the cache and
only a few calls would mean cherry picking in the array and performing
the bits twiddling.

They do not use this kind of tricks in their implementation. By using
them in ours, it would make more clear our code is really an original
one and not derived from their GPL code.


>> Luc
>>>>  There is also a Java implementation with multiple streams and
>>>>  substreams in SSJ: see the package rng:
>>>>  If you reimplement the code, this is a gray zone, but we do not have
>>>>  a patent on the algorithm.
>>>> So as I reimplemented from the paper itself (taking the erratas in <
>>>> into account) and use different optimization techniques (precomputed
>>>> indices tables), I would consider it is safe to publish this home-grown
>>>> code.
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail:
>>> For additional commands, e-mail:
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message