Pseudo-random number generators usually have several potential difficulties including:
The general concept is that the bits from the high order position in the original seed are shifted into the low order positions. The XOR operation between those two values "flips" some of the bits. Then the low order bits are shifted into the high order position to do the same thing. Once both shifts and flips are done, the resulting number becomes the new seed.
Notice that the sum of bits used in the two shifts adds up to be
the total length of the data type, in this case 8 bits.
If a 32-bit integer were used as the data type, the sum of the
left and right shift operations should equal 32.
Another important detail is that shifts are "open" or "unsigned",
where zeros fill from the left and the right.
|
|