Compare the runs in a two-symbol sequence with expectation
Paste a sequence of two symbols, such as coin faces or 0 and 1, and the tool counts the stretches of identical symbols (runs) and compares that count with its expected value. Spaces, commas and line breaks are ignored.
The formulas used
With counts n1 and n2 summing to n, E[R] = 2 n1 n2 / n + 1 and Var[R] = 2 n1 n2 (2 n1 n2 - n) / (n^2 (n - 1)). From the observed run count R, Z = (R - E[R]) / sqrt(Var[R]), and the two-sided p-value comes from the standard normal distribution. This is the Wald-Wolfowitz runs test. When the variance is 0 no Z can be formed, so the calculation is blocked.
Limits on reading the result
A p-value is not the probability of randomness: it is the probability of a run count at least as extreme as the observed one, assuming the null hypothesis holds. Failing to reject is not proof of randomness, and because the test looks only at clustering it cannot detect positional bias or longer-period patterns. The normal approximation is reported to apply when n1 and n2 are each at least 10, so a shortfall is flagged separately when it happens. Sequences with three or more distinct symbols are not calculated. Educational reference material as of October 2026.
Frequently asked questions
No. The p-value is the probability of a run count at least as extreme as the one observed, assuming the null hypothesis of randomness holds. It is neither the probability that the hypothesis is true nor the probability of randomness.
That cannot be concluded. The runs test looks only at how symbols cluster into consecutive stretches. Positional bias or longer-period patterns are invisible to it, so passing means the null was not rejected, not that randomness was proved.
It still computes, but when either symbol appears fewer than 10 times the normal approximation is reported to be unreliable, and a warning is shown in that case only. If the counts are so small that the variance becomes 0, the calculation is blocked.