in reply to Re: Check randomly generated numbers have not been used before
in thread Check randomly generated numbers have not been used before
This appears to be a Linear congruential generator for which the multiplier parameter a = 1. I'm far and far from being a PRNG expert (I'd bet BrowserUk could write a lengthy article on this topic before his first mug of caffeine-delivery-beverage-of-choice in the morning), but I think you need to exercise some caution in chosing the m a c parameters so that the period of the generator is maximized (i.e., equal to m) and the generator never gets "stuck" at a particular value of Xn. See the linked article. Just glancing at this article, I don't see any case in the "Parameters in common use" table of a = 1, so this may be a red flag.
Update: After more thought (and looking at pryrt's post), a multiplier a = 1 does seem to meet all the requirements for maximum period length for this type of PRNG, but gives a boring "clock" progression to the output, i.e., the output always advances by the offset mod S. Don't you want the output to bounce around a bit more and at least seem more random? ;)
Give a man a fish: <%-{-{-{-<
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Check randomly generated numbers have not been used before
by pryrt (Abbot) on Sep 16, 2016 at 18:49 UTC | |
|
Re^3: Check randomly generated numbers have not been used before
by GotToBTru (Prior) on Sep 16, 2016 at 20:29 UTC | |
by AnomalousMonk (Archbishop) on Sep 16, 2016 at 23:38 UTC |