edit 2 - I think I may have worded this slightly better here :
edit 1 - it looks like what I want is a non-repeating random sequence generator. This seems quite popular. Now if only my head hadn’t exploded… https://en.wikipedia.org/wiki/Mersenne_Twister
I want to specify a range of numbers (could be 1000 to 9999, or 1000000 to 9999999), and I want to be able to retrieve values in that range in an apparently random fashion. Easy enough, you say.
The catch is, I want to ensure I never get a repeated number until they have all been issued. Also, it may be months between fetches, so I want to be able to carry on where I left off last time.
Ideally, I would be able to seed it at the start, give it the last number I retrieved, and have it continue along the same sequence (making the process completely predictable but apparently random).
I’m a complete duffer at maths, and I cannot find the right words to put into google.
My mind is thinking down the path of - given a start number and the range, you could add a certain value (that wraps around at the end of the range) which gives a sort of impression of randomness but is stepping through in a not obviously linear way.
Someone might request a few of these in a row, so a sequence like 1240, 8241, 1241, 8242, etc. might be spotted.
Note I want a purely mathematical solution, not one involving SQL (I can do that already) or one that involves storing the previously selected numbers in any way (except for maybe the last selected number and any seed required). I know, moon on a stick
Does any of that make sense?