|
|
|
|
|
by barrkel
3221 days ago
|
|
Indeed; and careful selection of parameters for the LCG can truncate the ring to most arbitrary powers of two. And if you're willing to live with slight inefficiency (no more than twice as much work), an arbitrary modulo ring (shuffled sequence) can be produced by creating slightly larger range and skipping values that are outside the range. This is a question I asked on SO some years ago relating to this problem - producing a shuffled range of numbers without allocating an array: https://stackoverflow.com/questions/464476/generating-shuffl... |
|