"reproducible randomizing" - any good ways?
Posted: Sat Feb 09, 2008 2:56 pm
The problem: I have some parameter, a seed (say it's user ID) and want to generate a list of random numbers withing some range, but I'd also like to be able to regenerate that list in the future.
Example: I have users. Every user has a building. I have prepared X different images of windows (win1.png, win2.png ... winX.png) and want to generate a random list of those images (say list contains 100 elements, but it's not important), but be able to reproduce this list in the future. So: every user's building looks different, but when I reload the page of a particular user (say John, user_id=4), it will look the same as before.
Another requirements:
* every image has about the same chance of appearing, so that win1.png isn't used much more often than win40.png
* I'd like to be able to change X (and I'm fine with lists being different then before... so when I add 10 new windows to choose from, John's building won't look anything like before).
Are there any common ways of doing this? I could come up with some algorithm myself, but I'm sure others have done some efficient methods of achieving this result.
thanks in advance,
muszek
Example: I have users. Every user has a building. I have prepared X different images of windows (win1.png, win2.png ... winX.png) and want to generate a random list of those images (say list contains 100 elements, but it's not important), but be able to reproduce this list in the future. So: every user's building looks different, but when I reload the page of a particular user (say John, user_id=4), it will look the same as before.
Another requirements:
* every image has about the same chance of appearing, so that win1.png isn't used much more often than win40.png
* I'd like to be able to change X (and I'm fine with lists being different then before... so when I add 10 new windows to choose from, John's building won't look anything like before).
Are there any common ways of doing this? I could come up with some algorithm myself, but I'm sure others have done some efficient methods of achieving this result.
thanks in advance,
muszek