MCPcopy Index your code
hub / github.com/python/cpython / test_von_mises_range

Method test_von_mises_range

Lib/test/test_random.py:1159–1171  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1157
1158
1159 def test_von_mises_range(self):
1160 # Issue 17149: von mises variates were not consistently in the
1161 # range [0, 2*PI].
1162 g = random.Random()
1163 N = 100
1164 for mu in 0.0, 0.1, 3.1, 6.2:
1165 for kappa in 0.0, 2.3, 500.0:
1166 for _ in range(N):
1167 sample = g.vonmisesvariate(mu, kappa)
1168 self.assertTrue(
1169 0 <= sample <= random.TWOPI,
1170 msg=("vonmisesvariate({}, {}) produced a result {} out"
1171 " of range [0, 2*pi]").format(mu, kappa, sample))
1172
1173 def test_von_mises_large_kappa(self):
1174 # Issue #17141: vonmisesvariate() was hang for large kappas

Callers

nothing calls this directly

Calls 3

vonmisesvariateMethod · 0.95
assertTrueMethod · 0.80
formatMethod · 0.45

Tested by

no test coverage detected