[Numpy-discussion] Purpose for bit-wise and'ing the initial mersenne twister key?
Robert Kern
robert.kern@gmail....
Fri Feb 6 15:25:35 CST 2009
On Fri, Feb 6, 2009 at 15:24, Michael S. Gilbert
<michael.s.gilbert@gmail.com> wrote:
> In numpy/random/mtrand/randomkit.c on line 159, the initial mersenne twister key (populated from /dev/urandom) gets bit-wise and'ed with 0xffffffff. I'm just curious as why this is done. A bit-wise and with all ones should just give you your original quantity back, right? I don't think there is a problem since the operation doesn't really do anything, and the same thing exists in the mersenne twister reference code, but I am curious as to why it is even there in the first place. Thanks for any thoughts.
On most 64-bit machines, unsigned longs are 64 bits, so 0xffffffffUL
is only 32 bits of 1s.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the Numpy-discussion
mailing list