Page **1** of **1**

### VASSAL Random Number Generator (Dice)

Posted:

**February 8th, 2012, 5:14 pm**
by **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.

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'?

### Re: [messages] [Technical Support & Bugs] VASSAL Random Numb

Posted:

**February 8th, 2012, 5:48 pm**
by **tar**

The pseudo random number generator is built in.

It is believed to be quite good.

See

http://www.vassalengine.org/wiki/Faq_ge ... _random.3FAlthough you do seem to have collected data that may warrant further

investigation.

On Wed, Feb 8, 2012 at 9:14 AM, cfar

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'?

>

> ______________________________**_________________

> Read this topic online here:

> http://www.vassalengine.org/**forum/vie ... 7#**p30727

> ______________________________**_________________

> messages mailing list

> messages@vassalengine.org

> http://www.vassalengine.org/**mailman/listinfo/messages

>

### Re: VASSAL Random Number Generator (Dice)

Posted:

**February 8th, 2012, 7:11 pm**
by **cfar**

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.

Thanks for the quick reply.

### Re: [messages] [Technical Support & Bugs] Re: VASSAL Random

Posted:

**February 8th, 2012, 7:39 pm**
by **uckelman**

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.

### Re: [messages] [Technical Support & Bugs] VASSAL Random Numb

Posted:

**February 8th, 2012, 9:04 pm**
by **uckelman**

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.