On Fri, Feb 6, 2009 at 15:24, Michael S. Gilbert <michael.s.gilb...@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 _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion