← All tools

Kolmogorov-Smirnov Test

To prove an operator is cheating, you need more than a hunch. The Kolmogorov-Smirnov (K-S) Test is the mathematical gold standard to audit casino random number generators for RNG audits, verifying if their float streams are distributed perfectly uniformly, checking against our expected volatility models between 0 and 1.

Kolmogorov-Smirnov Test (vs uniform [0,1])

Paste floats in [0,1] — e.g. dice rolls divided by 100. Tool tests whether the empirical distribution matches uniform.

Sample size
D statistic
p-value
Critical value

The continuity advantage of the K-S test

When you audit a crypto casino, you get a stream of decimal floats (such as 0.485293, 0.129481, etc.) generated by their HMAC-SHA256 seeds. A basic audit might average these numbers and find that they equal roughly 0.50, concluding that the game is fair. This is a severe statistical oversight. An RNG could output exclusively 0.10 and 0.90, averaging 0.50, while being completely broken.

To verify true fairness, you must check the **uniformity** of the entire distribution. The Kolmogorov-Smirnov test is a non-parametric, continuous test that compares the cumulative distribution of your sample against a theoretical uniform distribution. Because it requires no binning, it is highly sensitive to subtle, hidden biases that other tests miss.

Non-Parametric Sensitivity: Chi-square tests force you to group continuous floats into discrete bins (like 0.0-0.1, 0.1-0.2, etc.). The K-S test does not bin data; it analyzes every single float at its exact coordinate, making it impossible for developers to hide clusters of favorable or unfavorable numbers.

The math: Calculating the D statistic and p-value

The K-S test operates by plotting the Cumulative Distribution Function (CDF) of your sample against the uniform CDF and locating the maximum deviation:

1. The Empirical CDF (F_n(x))

First, the $N$ floats in your sample are sorted in ascending order. The empirical step function ($F_n(x)$) increases by $1/N$ at each data point:

F_n(x) = (Number of elements in sample ≤ x) / N

2. The Kolmogorov D Statistic

We calculate the absolute vertical distance between your sample’s step function and the theoretical uniform line ($F_0(x) = x$ on the interval $[0,1]$). The test statistic $D$ is the supremum (maximum) of these differences:

D = supremum | F_n(x) - x |

3. Calculating the p-value

To evaluate if $D$ is statistically anomalous, the tool runs a Marsaglia-Tsang series calculation to compute the p-value:

  • p-value < 0.05: Highly anomalous. The probability of a fair RNG generating this distribution by chance is under 5%. The casino’s RNG is statistically proven to be biased.
  • p-value > 0.95: Too perfect to be true. This suggests the data has been artificially smoothed or manipulated to look fair, which is a common indicator of fraud in manufactured audits.

Step-by-step audit: Auditing 1,000 floats

Suppose you have extracted 1,000 round floats from your session history:

  1. Copy the raw list of continuous decimal floats (one per line).
  2. Paste the values into the auditor input box.
  3. Click “Verify.” The tool will sort the floats, calculate the step function, and compute the $D$ statistic.
  4. Check the p-value verdict: a fair, unmanipulated RNG will output a uniform p-value that typically falls between 0.10 and 0.90.

Frequently asked questions

What does a p-value of 0.0001 mean?

It means there is only a 1 in 10,000 chance that a perfectly fair random number generator would produce the distribution of floats you pasted. This is overwhelming statistical evidence that the casino’s RNG is biased, skewed, or actively manipulating outcomes.

Why is K-S superior to the Chi-Square test?

The Chi-Square test is highly dependent on how you choose to bin your data. If you bin poorly, you can easily smooth over anomalies. The K-S test is continuous and coordinate-independent, providing an exact, objective measure of uniformity that cannot be manipulated by bin sizing.

How many floats are required for an accurate K-S audit?

While the test can run on small samples, we recommend a minimum of 100 floats to detect moderate bias. For high-precision audits of professional casino seeds, a sample size of 1,000 to 10,000 floats is ideal to ensure statistical confidence.