# VASSAL Random Number Generator (Dice)

while paying None But Heroes I’ve noticed that over several hundred 2d6 rolls my average roll is just over 6.5. Probability theory indicates it should be 7.0 or very close to that number.

Is the random number generator associated with VASSAL contained within the VASSAL engine or does it use each computer in the game to generate a seed and the resultant series of numbers as a particular player ‘rolls the dice’?

The pseudo random number generator is built in.
It is believed to be quite good.
See
vassalengine.org/wiki/Faq_ge … _random.3F

Although you do seem to have collected data that may warrant further
investigation.

On Wed, Feb 8, 2012 at 9:14 AM, cfar cfar@knology.net wrote:

while paying None But Heroes I’ve noticed that over several hundred 2d6
rolls my average roll is just over 6.5. Probability theory indicates it
should be 7.0 or very close to that number.

Is the random number generator associated with VASSAL contained within
the VASSAL engine or does it use each computer in the game to generate a
seed and the resultant series of numbers as a particular player ‘rolls
the dice’?

_____________**
vassalengine.org/**forum/vie … 7#**p30727<VASSAL Random Number Generator (Dice)
_____________**
messages mailing list
messages@vassalengine.org
vassalengine.org/**mailman/listinfo/messageshttp://www.vassalengine.org/mailman/listinfo/messages

What drove me to look was a difference in my and my opponents results. He typically is averaging about 7.2. However is the pseudo random number generator is built in it just means he’s getting the top end numbers and I’m getting the bottom. Stuff happens.

I was concerned that if the random numbers were tied to the computer, I might as well give up on VASSAL.

Thus spake cfar:

I was concerned that if the random numbers were tied to the computer, I
might as well give up on VASSAL.

I think you have a misconception about how the random numbers are
generated. We’re using java.security.SecureRandom as our PRNG. It’s a
cryptographically-strong PRNG. It will be seeded the first time it’s
asked for a random number. If you’re running some Unix, the seed comes
from /dev/random or /dev/urandom; on Windows, it comes from the MS
Crypto API. (I checked this just now by looking at the JDK code.) It’s
quite likely that your seed will not be the same as your opponent’s,
but it’s also irrelevant for the fairness of the dice rolls, because
the serial correllation coeficient for this generator will be very close
to 0. This means that consecutive rolls are effectively independent
events, which is what you expect to be the case for fair dice.

That is to say: There would be no detectable difference between having
your rolls come from one instance of this PRNG and your opponent’s come
from another (as we do) and having them all come from the same one.

J.

Thus spake cfar:

while paying None But Heroes I’ve noticed that over several hundred 2d6
rolls my average roll is just over 6.5. Probability theory indicates it
should be 7.0 or very close to that number.

For 250 2d6 rolls, the probability that you’ll average exactly 6.5 with
fair dice is 0.00005, if I’ve done the math correctly. That is to say,
you’ll have that result 1 in 20000 times. If you expand your window, to,
say 6.5 +/- 0.1, you’ll get an average in that range with probability
0.00453, so that’s something which you’d expect to happen about 1 in 250
times. That’s not so improbable.

If you want to give our PRNG a proper test, take a few million rolls and
run a statistical suite on it, something like Ent or DieHarder. A few
hundred rolls is too small a sample.

J.