Rolling Two Dice with Weighted History

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram CDF Player or other Wolfram Language products.

Requires a Wolfram Notebook System

Edit on desktop, mobile and cloud with any Wolfram Language product.

This Demonstration simulates rolling two dice but speeds up convergence to the expected values. The first rolls simulate rolling two dice normally, while subsequent rolls are weighted according to the gambler's fallacy—numbers that have come up many times before are less likely to come up compared to the expected frequencies.


The "random seed" slider determines which sequence of dice rolls occurs, and the "rolls" slider determines which roll you see (expanding the slider and clicking + moves to the next roll). The default start is after 36 dice rolls, but you can reset the number of rolls back to zero. Adjusting any of the sliders other than "rolls" generates a new sequence of dice rolls.

The list of all rolls up to the current roll is shown, followed by the number of times each roll has occurred (in a list of the form , where is the number of times has occurred). For playing games, you can hide the data.


Contributed by: Laura Shou (September 2015)
Open content licensed under CC BY-NC-SA



With the "random" slider, you can determine whether a roll is random (with respect to the expected distribution) or follows the gambler's fallacy weights. The output shows whether the roll was random or based on a skewed history. Using the variable ensures that the first rolls are truly random (and do not follow the gambler's fallacy weights).

The frequency plot uses blue dots for the expected frequency (out of 100) and red dots for the observed frequency.

Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.