3 ms·
> There's some math that goes into picking a good constant, but honestly that's optional. It isn’t optional. For example, if your constant is even, every itera
by Someone 5y ago
> There's some math that goes into picking a good constant, but honestly that's optional.
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.
- Dylan16807 5y agoYes 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.