in reply to Help with x86_64 bit testing for CPAN module
my $xor = $mt[$i-1]^($mt[$i-1]>>30); { use integer; $mt[$i] = 1812433253 * $xor + $i; $mt[$i] >>= +32 if $mt[$i] > 0xffffffff }
It seems to work (at least this part), if you replace
$mt[$i] >>= 32 if $mt[$i] > 0xffffffff;
with
$mt[$i] &= 0xffffffff;
in mt_init_seed(), i.e. simply truncate the higher bits. In any case I then get the same init number sequence as with the Math::Random::MT C version.
Update: and if I replace the other 3 occurrences of the same pattern in mt_setup_array(), too, it does in fact pass all five tests...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Help with x86_64 bit testing for CPAN module
by tachyon-II (Chaplain) on May 22, 2008 at 23:59 UTC |