def test_stat_quantiles(self): rng = RandomNumberGenerator() rng.setState("0123456789ABCDEF") v = DoubleVector() for i in range(100000): v.append(rng.getDouble()) self.assertAlmostEqual(quantile(v, 0.1), 0.1, 2) self.assertAlmostEqual(quantile_sorted(v, 0.2), 0.2, 2) self.assertAlmostEqual(quantile_sorted(v, 0.3), 0.3, 2) self.assertAlmostEqual(quantile_sorted(v, 0.4), 0.4, 2) self.assertAlmostEqual(quantile_sorted(v, 0.5), 0.5, 2)
def test_rng_default(self): rng = RandomNumberGenerator() self.assertIsInstance(rng.getDouble(), float)