Search code examples
crandomendiannesspseudocodemersenne-twister

Mersenne Twister on Little Endian


Does the pseudocode provided in Wikipedia's article on Mersenne Twister work with Little Endian ("atomic element size" 8 or 16 bit), or any other byte-orderings?

Does it work on 32-bit only systems? (i.e. The number cannot be stored in anything bigger than a DWORD.)

EDIT: Also, what do they mean by 32nd bit of(MT[i])? MT[i] & (1 << 31) or MT[i] & 0x01 or something else?


Solution

  • The algorithm gives you a number. How you store it is irrelevant.

    You can have 32-bit numbers on 16-bit systems (ex. C long was 32-bits on 16-bit Windows).

    32nd bit means the high bit (MT[i] & (1<<31)).