RANDOMNESS & LOOT

RNG Fairness Tester

Chi-square bucket test on crypto or Math.random sources — is your RNG fair?

DISTRIBUTION CHECK

Run a fairness test

Browser-only
A quick χ² test on buckets is a decent sanity check, not proof of cryptographic quality. Math.random() often passes small tests yet is not seedable — for anything competitive, use a seeded PRNG (mulberry32, PCG) or crypto.getRandomValues.

RNG fairness guide

"It feels rigged" is the fastest way to lose player trust — whether it is loot, crits, or card draws. This tester runs a chi-square bucket test on your random source (or your game's drop history) so you can check whether the distribution looks fair before players start posting conspiracy threads.

What a chi-square test actually checks

Split N samples into buckets and compare each bucket's count to the expected count (N ÷ buckets). Chi-square sums (observed − expected)² ÷ expected across all buckets. If the total exceeds the critical value for your degrees of freedom (buckets − 1), the distribution is suspicious at the 95% confidence level.

It is a sanity check, not a proof: a fair RNG will still fail 5% of the time by chance, and a biased RNG can pass if the bias is small or the sample is small. Use enough samples (thousands) and re-run a few times.

The real fairness problem in games

Most games do not use a plain uniform RNG — they use pity timers, pseudo-random distribution (like Dota's PRD), or weighted pools that become more generous over time. Those are deliberately not uniform, and that is fine. What players object to is perceived streaks: 20 misses in a row feels broken even when it is mathematically fair.

If you want players to perceive fairness, clamp the tails: guarantee a hit after N misses, or use a shuffled bag (deal all outcomes once before reshuffling) like many card games do.

Tip: Test the RNG you actually ship with, not the one in your head. Paste real drop logs into this tool — the chi-square result is a great talking point in a dev log either way.

Frequently asked questions

What is a chi-square test?

A statistical test comparing observed counts per bucket against expected counts. Large deviations suggest the source is not uniform. This tool runs it live on data generated in your browser.

My RNG failed the test — is it broken?

Possibly, or it was bad luck (5% false-failure rate). Run it again with more samples. If it fails consistently, investigate: a modulo bias (rand() % n) is the most common culprit.

How many samples do I need?

At least 5× the bucket count for valid chi-square, but practically a few thousand. More samples = more reliable verdict. This tool defaults to 2,000.

Privacy note: RNG fairness tests run in your browser. Nothing is uploaded.