Subject: | bad XS argument for 32-bit |
Line 422 of MTwist.xs calls mt_lrand() with a state argument. The function does not take an argument.
Originally this was going to be a bug report/fix around the behavior of irand on 32-bit Perls:
perl -E 'say ~0; use Math::Random::MTwist qw/srand irand rand/; srand(42); say irand()'
4294967295
6.90904563742895e+18
where I would have expected:
# Changed MTwist.xs:382 to #if defined(UINT64_MAX) && IVSIZE >= 8
perl -Iblib/lib -Iblib/arch -E 'say ~0; use Math::Random::MTwist qw/srand irand rand/; srand(42); say irand()'
4294967295
1608637542
but I see the documentation points out that irand is aliased to irand64 and it coerces the result to a double on 32-bit Perl. I find this behavior completely bizarre, but it's documented that way. Unfortunately every rand-type module has implemented these functions differently. However the MTwist module is very well written and blazingly fast (which has a lot to do with the module construction and not just the MTwist code).