several Random instances

Hello,

I would very much like to have 2 different Random instances, one which poops out real-random (or the unity approach to that) and one of which I can set the seed to a given Integer, making it poop out the same sequence every game cycle.

What i tried:
searching on google ofcourse… but it qutie hard to formulate a question that is not ambigious.

I tried instantiating a Random object by var rnd = new Random() but this is just a new pointer to the Random instance which unity provides. (probably because it is a singleton or something like that)

I hope this is clear enough.

As for sample code with which I tested the outcome:

private var rand:Random;

function Awake(){
	rand = new Random();
	rand.seed = 18427;
    //Debug.Log either rand.value or Random.value -> both will be the same
}

You could use the .NET framework System.Random instead; that will let you have distinct instances. It’s still kind of a voodoo black box thing though, and you can’t read the seed, or reseed it if you want to generate the exact same sequence of numbers again (for instance, if you want to save and reload the state of your random number generator).

Fortunately a linear congruential generator is not hard to implement yourself; it may be perfectly sufficient for throwaway random number generation that doesn’t need to be particularly robust. See Linear congruential generator - Wikipedia

edit: actually this is the wiki page I was thinking of- Lehmer random number generator - Wikipedia