Re:Problems emerge for a unified /dev/*random
by Dylan16807 on Wednesday March 30, 2022 @04:23PM
(#30860326)
Yes it has to be odd and it has to be the size asked for. I don't count checking that as math.
If you're particularly worried about the top couple digits of the number being undersized you could return fewer bits or use a wider multiplier.
It isn’t optional. For example, if your constant is even, every iteration adds another zero to the end of your state, and after (in this case) 127 iterations, you’ll start returning zeroes forever.
Also, if your multiplier is smallish, the lower order ones of the current value can be used to (somewhat) predict the higher order ones of the next value.