Skip to main content
ShinobiToolsGet a pass

How Random Is It

How the random picks on these pages are made.

This guide explains how the picks on these pages are made and what the test above can and cannot tell you about them. The short answer to "is the wheel fair" is that every draw comes from the browser's cryptographic random source, is turned into a choice in a way that gives every option the same chance, and can be checked by running the live test yourself.

Where the randomness comes from

Every tool in this section, whether it is a wheel, the name picker, the team shuffle, dice, a coin or numbers, gets its randomness from one small piece of code. It calls crypto.getRandomValues, the function that browsers provide for security work and that the W3C Web Crypto API specification defines. It does not use Math.random, the simple generator that the MDN reference for Math.random says is not cryptographically secure. A lint check in the test suite fails if that function is ever used.

The browser hands back 32-bit whole numbers, which are numbers from 0 up to 4,294,967,295. If a browser has no such function, the tools stop and say "This browser cannot make a fair draw". They do not fall back to something weaker.

Rejection sampling in plain words

A raw 32-bit number is not yet a choice. To choose among 6 options you need a number from 0 to 5, and the tempting shortcut is to divide by 6 and keep the remainder. That slightly favors the first options, because 4,294,967,296 does not divide evenly by 6: it leaves a remainder of 4, so the last 4 raw values have no full set of 6 to complete.

A smaller case shows the effect. Imagine a source that gives numbers 0 to 7 and you need 6 options. With the remainder shortcut, raw 6 and 7 wrap around to options 0 and 1, so those two get 2 chances in 8 and the others 1 in 8. Rejection sampling fixes this: if the source gives 6 or 7, throw it away and draw again. Each remaining value then lines up with exactly one option.

The same rule runs on the real source. The code works out the largest block of values that divides evenly, throws away any raw number outside it, and draws a new one. The chance of a redraw is at most the number of options divided by 4,294,967,296, so it almost never happens. Weighted choices such as "Pizza *3" use the same function: the weights are added up, one whole number below the total is drawn, and the entries are counted off until that number is used up. Shuffles for teams and picks use the Fisher-Yates method, a standard shuffle described on Wikipedia, built on the same function.

How the live test works

The test above picks a number of options from 2 to 100 (the default is 6) and draws 100,000 times through exactly the code the tools use. It counts how often each option came up and draws the counts as bars, with a dashed line at the even split. For 6 options that line sits at about 16,667.

It then runs a chi-square goodness-of-fit test, a standard method described in the NIST Engineering Statistics Handbook. In short, it measures how far the counts are from an even split, weighs each gap against what is expected, and adds them up. The page shows that sum, the degrees of freedom (the number of options minus one) and a p-value, which says how often a fair source would land this far from even or further.

What the verdict does and does not prove

If the p-value is below 0.001, the page says the result is further out than chance explains in about 1 run in 1,000, and suggests you run it again. Otherwise it says the variation is normal. Note the catch: a perfectly fair source lands below 0.001 about once in a thousand runs, so one odd run is not a fault, but an odd run that repeats would be worth a report to us.

A pass means these 100,000 draws look like chance for that many options. It does not certify the browser's source, it does not test every number of options at once, and it cannot rule out a flaw that only shows in rare patterns. It is a check you can watch happen, not a guarantee. The numbers on the screen come from your own browser, measured live, and are not stored or sent anywhere.

Sources

To see the draw in use, spin the wheel, or try the coin flip.

Frequently asked questions

Is the wheel fair?

Every slice has the chance its size and weight call for, and the draw comes from the browser's cryptographic source with rejection sampling. The winner is drawn before the animation starts, so how long or how fast the wheel turns changes nothing.

Why are the bars never exactly equal?

Equal bars would be the suspicious result. Real chance gives counts close to the even split, never identical, and they change on every run.

What does the chi-square number mean?

It adds up how far each count is from the even split. A small number means the counts look like chance, and a large one means they are further out than chance usually explains.

Could a fair test still show a bad result?

Yes, about once in 1,000 runs. That is why the page tells you to run it again before drawing any conclusion.

Does the test send my data anywhere?

No. The draws, the counts and the chart exist only in this page while you look at it.