I need to generate random numbers based on multiple seed values, need some ideas on how to do this.
Sample situation: Say you’re coding a procedurally generated sci-fi game, that needs to create planets (size,type,resources,etc) as the player flies into a certain solar system. You have a game ID, and X,Y,Z coordinates of the planet. Now what to feed the random number generator? I can’t just add the numbers up, of course, as planet (1,2,3) would be exactly the same as planet (3,2,1). What’s a coder to do?
Assuming you always need the same seed every time for the set of coordinates: just encrypt a concated string with MD5 or some other hash algorithm. md5(“1,2,3”) is not the same as md5(“3,2,1”). Or if you need a purely numeric string, use something like: “first digit * 9” + “second digit * 8” + “third digit * 7” that will give you more variety.
If you don’t, use the above methods with a random number.
In this case, pseudo random will be good enough.