libc++ contains a number of unit tests for the random number distributions found in the C++ Standard Library. They mostly take two forms, either comparing the sample mean, variance, skew, and kurtosis to the analytic values, or applying the Kolmogorov-Smirnov test. These test statistics are themselves random variables, and in most cases their distributions are not known analytically. Therefore, it is not obvious what the critical values should be, even if a significance level were agreed upon.
This program approximates the critical values by sampling each distribution several times with different seeds for the
underlying PRNG. Obviously this is circular, but these distributions have been part of the C++ Standard for over a
decade, so it seems unlikely that there are obvious errors in the major implementations. The libc++ tests specify the
maximum absolute difference from the expected value (mostly relative, sometimes absolute), so the critical value is the
half-width of the smallest symmetric interval around the median that contains piecewise_constant_distribution
, the maximum absolute and relative values among all the
intervals is given.