RNG -- 1 followed by 4, then 4 followed by 1

Right. It happens way too often to be just a coincidence. Whenever I roll 1,4 (2d6), I roll then a 4,1. Usually that turn I get relatively low rolls.

Listen, I am a mathematician and I know how statistics and probability work–had six full courses on that and my master thesis was loosely connected with probability (maybe even not that loosely but that is not the point). I am just wondering whether someone has observer certain patterns in RNG behaviour. Just being curious.

Out of curiosity, also: when Vassal resets the RND? May it happen that RND is reset–under certain circumstances–a number of times each log, using the same seed? How can I ensure?

Thus spake grouchysmurf:

Right. It happens way too often to be just a coincidence. Whenever I
roll 1,4 (2d6), I roll then a 4,1. Usually that turn I get relatively
low rolls.

Listen, I am a mathematician and I know how statistics and probability
work–had six full courses on that and my master thesis was loosely
connected with probability (maybe even not that loosely but that is not
the point). I am just wondering whether someone has observer certain
patterns in RNG behaviour. Just being curious.

We’ve had people observing patterns in dice rolls for virtually the
entire time VASSAL has existed, but to date no such observation has
withstood statistical analysis. You’re welcome to try if you like.

Out of curiosity, also: when Vassal resets the RND? May it happen that
RND is reset–under certain circumstances–a number of times each log,
using the same seed? How can I ensure?

We use java.security.SecureRandom for our PRNG. The SecureRandom object
is created when a game module is loaded, and used the default
initialization, which in the case of SecureRandom means that it is
seeded the first time it is used. On Unix, the seed comes from
/dev/random; on Windows the seed comes from some system API (which you
can find in the JDK source code if you need to know what it is exactly).


J.

Alright, how would I generate thousands of random dice rolls in Vassal?

Assign a hotkey to the Dice component in the module
With the module running put a weight on that key on your keyboard - let run for hour or so :smiley: :smiling_imp:

And how would I access generated values? vlog is a zip folder but file that stores the data is in proprietary vassal format.

Thus spake grouchysmurf:

Alright, how would I generate thousands of random dice rolls in Vassal?

There’s no straightforward way to do that from within VASSAL. If you
want to test the PRNG, the easiest way to do that is with the following
Java program:

import java.security.SecureRandom;
import java.util.Random;

public class Test {
public static void main(String[] args) {
int rolls = Integer.parseInt(args[0]);
final int sides = Integer.parseInt(args[1]);

final Random prng = new SecureRandom();

for ( ; rolls > 0; --rolls) {
  System.out.print(prng.nextInt(sides) + 1);
  System.out.print(' ');
}

System.out.println("");

}
}

Example usage:

$ java Test 10 6
1 5 2 3 3 6 1 6 2 3

The PRNG setup is the same as is done in GameModule.java and the call
to nextInt() is the same as is done in DiceButton.java, so accurately
replicates what VASSAL does for dice rolling. This should be easy enough
to modify to produce input for whatever statistics package you want to
try.


J.

Thus spake grouchysmurf:

And how would I access generated values? vlog is a zip folder but file
that stores the data is in proprietary vassal format.

Again, no good way to do this in VASSAL 3.2. See the program I provided
above for a way to get data generated in an equivalent way.


J.

This way I can only test how the above code works–not how Vassal works. Don’t tell me that’s exactly same code as in Vassal :wink:

Thus spake grouchysmurf:

“uckelman” wrote:

Thus spake grouchysmurf:

Alright, how would I generate thousands of random dice rolls in
Vassal?

There’s no straightforward way to do that from within VASSAL. If you
want to test the PRNG, the easiest way to do that is with the
following
Java program:

This way I can only test how the above code works–not how Vassal works.
Don’t tell me that’s exactly same code as in Vassal :wink:

The function call which generates die rolls is the same as in VASSAL.
Check it against line 172 of src/VASSAL/build/module/DiceButton.java.
All I’ve omitted is the constant modifier.


J.

If it helps at all, I had a 2d6 dice button run 5000 times (one session). Every time 1,4 was rolled (133 times), I had it print out the next roll (so there was a couple actions occurring automatically between each roll - does that matter, affect it at all? - I have no idea). Anyway, looks fine at a glance to me - I really like vassal’s randomness myself - but you can crunch the numbers. Let me know if you want a larger output. Again, just hoping this helps.

<<$previousrolls$ – ($2d6_result$) *>>

  • 1,4 – (2,4) *
  • 1,4 – (1,4) *
  • 1,4 – (1,3) *
  • 1,4 – (2,6) *
  • 1,4 – (1,5) *
  • 1,4 – (3,2) *
  • 1,4 – (4,6) *
  • 1,4 – (6,1) *
  • 1,4 – (2,2) *
  • 1,4 – (2,2) *
  • 1,4 – (3,4) *
  • 1,4 – (3,6) *
  • 1,4 – (2,4) *
  • 1,4 – (6,5) *
  • 1,4 – (3,1) *
  • 1,4 – (3,1) *
  • 1,4 – (4,4) *
  • 1,4 – (3,1) *
  • 1,4 – (1,4) *
  • 1,4 – (5,3) *
  • 1,4 – (1,2) *
  • 1,4 – (4,6) *
  • 1,4 – (2,2) *
  • 1,4 – (5,1) *
  • 1,4 – (3,3) *
  • 1,4 – (1,5) *
  • 1,4 – (1,6) *
  • 1,4 – (3,4) *
  • 1,4 – (4,1) *
  • 1,4 – (6,4) *
  • 1,4 – (1,4) *
  • 1,4 – (3,4) *
  • 1,4 – (4,3) *
  • 1,4 – (1,4) *
  • 1,4 – (5,4) *
  • 1,4 – (2,6) *
  • 1,4 – (5,3) *
  • 1,4 – (1,1) *
  • 1,4 – (2,4) *
  • 1,4 – (3,3) *
  • 1,4 – (5,1) *
  • 1,4 – (6,5) *
  • 1,4 – (1,2) *
  • 1,4 – (5,1) *
  • 1,4 – (1,5) *
  • 1,4 – (6,2) *
  • 1,4 – (1,1) *
  • 1,4 – (6,6) *
  • 1,4 – (4,6) *
  • 1,4 – (3,2) *
  • 1,4 – (6,5) *
  • 1,4 – (1,3) *
  • 1,4 – (2,2) *
  • 1,4 – (3,5) *
  • 1,4 – (1,5) *
  • 1,4 – (4,6) *
  • 1,4 – (6,4) *
  • 1,4 – (2,5) *
  • 1,4 – (6,6) *
  • 1,4 – (5,5) *
  • 1,4 – (6,5) *
  • 1,4 – (3,1) *
  • 1,4 – (1,1) *
  • 1,4 – (4,2) *
  • 1,4 – (1,3) *
  • 1,4 – (3,2) *
  • 1,4 – (3,3) *
  • 1,4 – (1,5) *
  • 1,4 – (5,4) *
  • 1,4 – (5,4) *
  • 1,4 – (4,5) *
  • 1,4 – (6,4) *
  • 1,4 – (2,1) *
  • 1,4 – (5,1) *
  • 1,4 – (5,6) *
  • 1,4 – (4,2) *
  • 1,4 – (1,6) *
  • 1,4 – (6,3) *
  • 1,4 – (5,2) *
  • 1,4 – (1,3) *
  • 1,4 – (5,3) *
  • 1,4 – (1,4) *
  • 1,4 – (2,2) *
  • 1,4 – (4,3) *
  • 1,4 – (4,6) *
  • 1,4 – (2,4) *
  • 1,4 – (3,4) *
  • 1,4 – (3,6) *
  • 1,4 – (3,3) *
  • 1,4 – (3,5) *
  • 1,4 – (2,3) *
  • 1,4 – (2,5) *
  • 1,4 – (3,5) *
  • 1,4 – (2,5) *
  • 1,4 – (1,1) *
  • 1,4 – (3,3) *
  • 1,4 – (3,5) *
  • 1,4 – (2,6) *
  • 1,4 – (6,4) *
  • 1,4 – (4,3) *
  • 1,4 – (3,4) *
  • 1,4 – (5,5) *
  • 1,4 – (1,2) *
  • 1,4 – (5,3) *
  • 1,4 – (4,1) *
  • 1,4 – (2,1) *
  • 1,4 – (3,6) *
  • 1,4 – (2,5) *
  • 1,4 – (5,1) *
  • 1,4 – (1,1) *
  • 1,4 – (6,1) *
  • 1,4 – (4,3) *
  • 1,4 – (4,6) *
  • 1,4 – (1,6) *
  • 1,4 – (4,2) *
  • 1,4 – (6,1) *
  • 1,4 – (5,4) *
  • 1,4 – (1,4) *
  • 1,4 – (4,6) *
  • 1,4 – (4,6) *
  • 1,4 – (1,3) *
  • 1,4 – (3,5) *
  • 1,4 – (3,2) *
  • 1,4 – (5,5) *
  • 1,4 – (4,5) *
  • 1,4 – (6,6) *
  • 1,4 – (4,1) *
  • 1,4 – (2,1) *
  • 1,4 – (4,6) *
  • 1,4 – (6,6) *
  • 1,4 – (1,1) *
  • 1,4 – (5,2) *
  • 1,4 – (2,2) *