Questions about _random_

Cliffski (though I suppose others too if you have any insights?),

I have a few questions about using random.

The first is about the using random multiple times. If you use random multiple times as influences, does it take a new value each time, or will it use the same value for each one? If I explain why I’m asking, it may become a little clearer. I am thinking about the following case:

[influences] 0 = "_random_,0.0,0.2" 1 = "_random_,0.0,0.2" 2 = "_random_,0.0,0.2" 3 = "_random_,0.0,0.2" 4 = "_random_,0.0,0.2"

If each random value is the same here, this will work the same as just using:

0 = "_random_,0.0,1.0"

But if it takes on a different value each time it’s called, it will give you an approximate Gaussian distribution. It seems to be the latter, but it’s not very easy for me to test directly. So I figured I’d just ask.

It also appears I can use random in other places, like inputs to simulation values. Is there any technical, game engine reason this is a horrible idea?

Finally, random always seems to be seeded from the same seed when you start a new game. This means that ‘random’ events happen the same way each game. This can clearly be seen if you have a simulation value that uses its only input as “random,0,1”, as it gives you exactly the same pattern each time. Is there a way to avoid this somehow?

The reason I’m asking is that I’m trying to create a variable with a smoothed random walk. I am doing this by creating a simulation value that has it’s value set using five instances of “random,0,0.2” which appears at least to give me a Gaussian distribution. Then I have a second simulation variable which is seeded off of itself with a one turn lag (so uses the same value as last turn) plus the value of the Gaussian simulation value averaged over the last four turns using 1, 2, 3 and 4 turn lag adjusted so it’s between -0.2 and +0.2. This seems to work. However, every time I run the game I get the exactly the same random walk out of it, which is a little frustrating. It also makes it harder to tell if the whole Gaussian thing is working.

Thanks for any help you can offer!

-El

Hello. I’m 99% certain that the values are all different, so you can indeed achieve what you are doing.
The fixed random seed was a design decision to make balancing easier (or rather…possible!). I am strongly considering making this a togglable option in the games options screen, if that helps?
I like your idea, it’s a very clever way to do things :smiley:

Thanks Cliffski, that’s really helpful. I definitely understand why the random seed needs to fixed during development, for testing stuff out. But now that it’s released, it would be good to at least have the option of proper randomness? So I definitely strongly support your suggestion for a toggle option of a random seed.

Thanks again,

-El