On 14 December 2012 18:24, Craig A. Berry <craig.a.berry@gmail.com> wrote:
> On Fri, Dec 14, 2012 at 10:28 AM, Nicholas Clark <nick@ccl4.org> wrote:
>> On Fri, Dec 14, 2012 at 10:06:30AM -0600, Craig A. Berry wrote:
>
>>> MT Classic stores state in an array of 624, 32-bit integers.
>
>> Gulp. Something over 2k.
>
> My reaction as well. There is TinyMT, which I mentioned way back in
> this thread, that uses only 127 bits of state:
> <http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/TINYMT/index.html>.
> Of course it doesn't provide as much randomness as the full MT. I
> have no idea how much randomness is enough or how TinyMT compares to
> drand48(). If it compares favorably, that might be the way to go.
I just pushed smoke-me/tinymt32 which merges in the code for the 32
bit implementation of TinyMT.
Personally I think ripping out support for the system RNG would a big
improvement. It was way easier to sidestep the existing logic than it
was to integrate using tinymt32 separately.
There may be missing bits. I have a feeling I have to do something
during interpreter clone that Im not doing yet.
cheers,
Yves
commit e84331211cf28a7345869e4aef4520754a272683
Author: Yves Orton <demerphq@gmail.com>
Date: Sat Dec 15 18:55:28 2012 +0100
Enable TINYMT32
Make perl use Tiny MT (32bit) RNG generator.
commit c5edafd44fe5a818fca631fc8a9c03c780b0ab4e
Author: Yves Orton <demerphq@gmail.com>
Date: Sat Dec 15 18:40:33 2012 +0100
Add support for using Tiny MT, a 128 bit state RNG
Perl traditionally uses the systems random number generator
for the rand() function. This means that the behavior of code
using it is platform dependent. Worse, sometimes the random
number generator is of poor quality.
This patch adds support for using the TinyMT random number
generator (32 bit version) instead. This generator is of relatively high
quality, uses 128 bits of state and is relatively fast and should be
portable to all of our build targets.
Note that this patch does not *enable* using tinym32, to do that
you need to define TINYMT32 during configure.
Full details of the algorithm can be obtained at
http://www.math.sci.hiroshima-u.ac.jp/~m-mat@math.sci.hiroshima-u.ac.jp/MT/TINYMT/
Derived from code by Mutsuo Saito and Makoto Matsumoto published under the
BSD 3-clause license.
Copyright (c) 2011 Mutsuo Saito, Makoto Matsumoto, Hiroshima
University and The University of Tokyo. All rights reserved.
--
perl -Mre=debug -e "/just|another|perl|hacker/"
Thread Previous
|
Thread Next