[Numpy-discussion] Purpose for bit-wise and'ing the initial mersenne twister key?

Michael S. Gilbert michael.s.gilbert@gmail....
Fri Feb 6 15:24:18 CST 2009

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.


More information about the Numpy-discussion mailing list