Bit-twiddling
Ivan Frohne
frohne at gci.net
Thu Jul 29 12:20:56 EDT 1999
More information about the Python-list mailing list
Thu Jul 29 12:20:56 EDT 1999
- Previous message (by thread): Wrong "From:" address!
- Next message (by thread): Bit-twiddling
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> Based on this advice I took a stab at the rest of the algorithm and > now it actually works! Wheee! So if anyone wants a string of random > numbers with a period of 2**199937-1 and equi-distributed in 623 > dimensions, just let me know. :-) > > | if-you're-really-after-random-numbers-see-ivan-frohne-ly y'rs - tim I have a new version of the Mersenne Twister just around the corner that uses the Numeric module if it's available. This makes it almost as fast as whrandom. To get a right shift for ordinary integers that always shifts in high-order zeros, this works (x is an ordinary 32-bit signed integer): x >> 1 & 0x7FFFFFFF # Logical right shift 1 x >> 2 & 0x3FFFFFFF # Logical right shift 2 ..... x >> 11 & 0x001FFFFF # Logical right shift 11 etc. --Ivan Frohne
- Previous message (by thread): Wrong "From:" address!
- Next message (by thread): Bit-twiddling
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list