# Multiple diferent Random values in one frame

Hi guys, here’s my problem:

I have the same script on three objects (that are instantiated simultaneously).
The script just gets a random Time between 3 and 5 seconds and then destroys the object.

My problem:
When I use `Random.Range(3, 6)` all three objects have the same random time
which also is the lowest value in the range (3 in this case).

When I use `Random.Range(3.0, 6.0)` there is a very slight difference in the timer, somwhere in the later decimal places - however it’s hardly noticable.
And again, they are very close to the lowest value.

I figure, this stems from the random seed, which is set once per frame (i guess). Since all scripts ask for the reandom numbers in the same frame, the answer is the same to all of them (or in the case of random float, some split-second difference)

What i tried so far:

• instantiating the objects with a slight delay (via yield): not a good idea, very funny results (10 clones flying around …)
Maybe there is a betterway to do this - it just shouldn’t be so complicated, as the script so far is very simple and will be used a lot.

• trying to work with the slight differences in the float version by multiplying.
That basically worked, but the range of results is too big.
( `Mathf.Pow(Random.Range(0.01, 0.02)*1000,2) / 20;` varies anywhere from 5 to 20 secs … still, it’s mostly 5

Now here’s my actual question: How can I get different random values in one frame?
I thought of changeing the `Random.Seed` manually, but since each Random function is in its own script an works simultaneously i guess they wouldn’t affect each other.

So alternatively: What would you do? Maybe my approach wasn’t very good to begin with.

You could try set the Randon.seed to a random number each frame: http://docs.unity3d.com/ScriptReference/Random-seed.html

This should tell you if it’s the random seed causing the issue or something else.

function Start () {
Destroy (gameObject, Random.Range (3, 6));
}

Works as expected. Don’t touch Random.seed or try to do anything fancy with weird math or anything.