Chaos Project

RPG Maker => General Discussion => Topic started by: atomburst on June 14, 2008, 11:52:18 pm

Title: the secret about randomized variables
Post by: atomburst on June 14, 2008, 11:52:18 pm
hi i was recently just messing about with randomizing bgm for my maps and i came across something interesting when i was testing. i noticed that the randomizing of variables values does not seem to actually be random at all. there is a tendancy for certain values to be picked more often and others to be picked almost never. of course this could be the randomization but i tested this many many times. i have tried to make the certain background music that wasnt being played very often to play more times. the way i tried doing this was add the same song to 4 different variable values and the rest to only 1 value. yet after testing this i still found that the same songs seemed to be playing and this particular song wasnt being played very often. has anybody else found this? any ways to overcome this?

Title: Re: the secret about randomized variables
Post by: Starrodkirby86 on June 15, 2008, 12:55:05 am
Any ways to overcome this? Why, make the random values more broad...Set different numbers for Variables. Instead of the random values...0-3, try something like 6-9. Sure, it sounds quite stupid, but it may work. I never seem to get this random problem, but I never was interested in seeing the truth how RPG Maker does the random calculations. But I'm sure that above would work more. ;)
Title: Re: the secret about randomized variables
Post by: Blizzard on June 15, 2008, 07:46:34 am
The thing is that it's not really random, it's pseudorandom. It works like this: There is a special function which takes the number of seconds past since 1.1.1970 and does a few operations on it. The resulting number seems to be random and the distribution of generated numbers isn't 100% accurate. i.e. in 10000 randomly generated numbers from 1 to 6 the distribution could be like:

1 - 1634
2 - 1678
3 - 1664
4 - 1651
5 - 1687
6 - 1686

The distribution is still alright with a little deviation.
Title: Re: the secret about randomized variables
Post by: Starrodkirby86 on June 15, 2008, 11:37:47 am
Quote from: Blizzard on June 15, 2008, 07:46:34 am
The thing is that it's not really random, it's pseudorandom. It works like this: There is a special function which takes the number of seconds past since 1.1.1970 and does a few operations on it. The resulting number seems to be random and the distribution of generated numbers isn't 100% accurate. i.e. in 10000 randomly generated numbers from 1 to 6 the distribution could be like:

1 - 1634
2 - 1678
3 - 1664
4 - 1651
5 - 1687
6 - 1686

The distribution is still alright with a little deviation.

Wait...1.1.1970!? Is that January 1st, 1970!? Holy carps, Batman! That's insane...a good majority here aren't born at that time, and I can definitely prove that. Are you even born during that time Blizzard? o.o
And dost thou know what is this random calculation? Algorithm perhaps?
Title: Re: the secret about randomized variables
Post by: Blizzard on June 15, 2008, 01:03:56 pm
I suppose that's around the time the first actual OSes were made like DOS and so on. Sadly, I don't know the calculation pattern. I suspect that it can even differ from programming language to programming language.

And no, I was born August 4th, 1986. -_-