Repeatable pseudo-random sequences with Random

I read in another thread that Unity’s PRNG uses this Xorshift 128 algorithm: http://en.wikipedia.org/wiki/Xorshift

For my game I usually seed the RNG when the game starts with the UTC milliseconds. Then the PRNG generates a range of numbers for different game events. When a user saves a game at some point, I want to somehow save the current seed/state of the generator along with the save game, so that I can reset it after loading the save game. This mechanic ensures that the game behaves the same for a short time after each reload.

Is there a way to get the current seed from Random so that it will pick up at the same point in the number sequence after a reload? Or doesn’t Xorshift work that way? I really want to avoid using a custom LCG because I need to generate a lot of random numbers and need every speed advantage I can get.

Each time you get to a save point compute and store the seed that you use at that point. There is no reason why you have to use the UTC milliseconds as the seed at the start of the game.

Random.seed should do what you want. It’S a property with getter and setter.