- Home /
Random number at a specific position
Is there a way to get a random number from a specific position. I have my terrain random generator set up so it will generate new world as you go and unloads it behind you, and saves your seed when you quit. Now if I want to load in a specific segment, what should I do?
Answer by AchillesWF · Apr 22, 2012 at 07:46 PM
Perhaps you could save off the number of segments that you have generated prior to quitting (as you do the seed value)? Then, on load you could "dispose" of that many random numbers (simply loop through and generate then forget them) so that you wind up at the segment you want (given by the index from segment 0 generated with the original seed).
Alternatively, you could come up with your own formula to create a unique seed to use to initialize the random number generator just ahead of a call to produce a new segment. In this way you can return to a segment by calculating its seed using your own formula.
disposing them will be a big overhead, so I guess I'l make my own algorithm.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
How to Activate Random GameObjects? (C#) 1 Answer
Spawn Random Enemy 3 Answers
instantiating vertically 2 Answers