Randomness is one of the few things in software that looks correct while being wrong, which makes it worth testing deliberately.
This post is about a small toolkit and the testing questions behind it: what do you actually want to know about a random source, and how do you check it without a statistics degree?
Three different questions
People say "is it random" and mean at least three different things:
- Uniformity. Does each value appear with roughly the expected frequency?
- Independence. Does knowing one output tell you anything about the next?
- Reproducibility. Can you replay a sequence when you need to debug?
These need different tests, and a tool that only addresses one will give false confidence about the others.
Uniformity in practice
For a die roll or a coin flip, uniformity is easy to eyeball over a few thousand samples: the counts should be close to each other, and the deviation should shrink as the sample grows. The mistake is testing with too small a sample and concluding from noise.
A useful rule: run the test, double the sample, run it again. A real bias stays roughly proportional. A fluctuation disappears.
Independence is the one people skip
Uniform marginals do not imply independence. A generator that outputs 1,2,3,4,5,6,1,2,3,4,5,6 is perfectly uniform and completely predictable. Checking for runs and repeats is what distinguishes a real source from a shuffled constant.
Reproducibility is a debugging feature
For anything involving a fair draw — giveaways, seeded content, game logic — the ability to replay a sequence is what makes a result auditable. Seed the generator, log the seed, and you can answer "why did this turn out this way" instead of shrugging.
Try it with numbers you can check
This number analyzer and random toolkit runs in the browser and includes dice, coins, sequences, and an odds breakdown, which makes it easy to run the uniformity check yourself and watch the deviation shrink as the sample grows. It is a better way to build intuition than reading about chi-square.