New account registration is temporarily disabled.

RPG MAKER 2003'S RANDOM NUMBER GENERATOR

Posts

Pages: 1
Hi,

This message is mostly for Cherry, Kazesui, and the others who have taken apart 2003's inner workings.

Would anyone happen to know how the random number generator in RPG Maker 2003 works? I've noticed that it isn't very random, acting somewhat stubborn to change to a new value over different iterations sometimes. I want to know if there's a way to refresh its seed.
Addit
"Thou art deny the power of Aremen?!"
6394
Yeah, it seems like that happens sometimes with the random number generator.

You could always have it cycle through it twice just to be on the safe side or a put a 0.0 Wait after going through the random number generator. I usually just use the 0.0 Wait before coming up to the conditional branch where it needs to cycle through the list of random numbers so it has a bit of time to go through it.
I was curious if my concerns were warranted. I wrote a simple program which selects a random number between 1-3 and then increases a variable based on the selection. It loops 1,000 times and then shows the results.

There was never more than a 40-count different between the random selections. Even when the random number spread was increased to 12 and the sections divided evenly, those three sections of 12 were still pretty even.

But it really does seem like the random number generator rolls up a certain value an inordinate number of times.
Random != Balanced.

A good RNG will on occasion turn up the same number multiple times.
I agree, although six times in a row was pushing my belief of "random".
If you roll a dice, it will come up the same 4 times in a row. It will come up the same ten times in a row, eventually.

How big is your sampling? More importantly, how many iterations before you get another run of 4? You need to know the period of such occurrences before you can draw any conclusions.
It's highly likely that the random number generator used in rm2k3 is a linear congruential generator. This is a generator which should be sufficient for any rm2k3 need, and I haven't found any problems with it's distribution of numbers.

If you just don't want repeating values rather than random values, you might want to consider making an array of the possible outcomes and then shuffling the array.
This way, you'll get every option once in a random order with no repeats.
Linear congruential generator: Yes. RM2k3 just uses Delphi's RandomRange function.
See http://stackoverflow.com/questions/3946869/how-reliable-is-the-random-function-in-delphi
Pages: 1