commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles <gil...@harfang.homelinux.org>
Subject [Math] Add 64-bits based RNG (Was: [Math] New base class for all RNGs)
Date Sun, 10 Jan 2016 04:09:21 GMT
Hi.

Relevant excerpt of previous posts:

>> [...]
>>
>> Something implicit in "BitStreamGenerator": the maximum number of
>> bits is 32 (cf. return type of "next(int)" and the ubiquitous use
>> of hard-coded "32".
>>
>> What about the possibility of using a "long" as a building block
>> for another family of RNG?
>
> Why?  We don't have contributions of other RNGs implemented using
> 64-bit blocks of data.  In theory, I guess you could do that, but I
> don't know of any and all the ones we have use 32-bit words.
>
> Phil
>>
>> Gilles

(1)
CPUs and OS are nowadays commonly 64-bits based.
Thus one could legitimately wonder whether, on such systems, generating
   one "long" value
would not be faster than generating
   two "int" values,
especially when 64 bits are necessary in order to produce the next 
random
"long" or "double" value.

(2)
There indeed exist 64-bits implementations of RNGs:
   
http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/VERSIONS/C-LANG/mt19937-64.c
   http://burtleburtle.net/bob/rand/isaacafa.html


I thus propose to create a feature branch that will contain
* a new interface, for when "nextLong()" is the "random bits" producer
* the (adapted) "xorshift1024*" RNG implementation from
     http://xorshift.di.unimi.it/
* an "adapter" to the existing generic methods
* benchmarking code


Gilles


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message