cpython: 6a3d18cede49 (original) (raw)

Mercurial > cpython

changeset 82129:6a3d18cede49 2.7

Issue #17149: Fix random.vonmisesvariate to always return results in [0, 2*math.pi]. [#17149]

Mark Dickinson dickinsm@gmail.com
date Sun, 10 Feb 2013 14:13:40 +0000
parents 010b455de0e0
children 0f9113e1b541
files Lib/random.py Lib/test/test_random.py Misc/NEWS
diffstat 3 files changed, 19 insertions(+), 2 deletions(-)[+] [-] Lib/random.py 4 Lib/test/test_random.py 14 Misc/NEWS 3

line wrap: on

line diff

--- a/Lib/random.py +++ b/Lib/random.py @@ -475,9 +475,9 @@ class Random(_random.Random): u3 = random() if u3 > 0.5:

return theta

--- a/Lib/test/test_random.py +++ b/Lib/test/test_random.py @@ -533,6 +533,20 @@ class TestDistributions(unittest.TestCas self.assertAlmostEqual(s1/N, mu, 2) self.assertAlmostEqual(s2/(N-1), sigmasqrd, 2)

+ class TestModule(unittest.TestCase): def testMagicConstants(self): self.assertAlmostEqual(random.NV_MAGICCONST, 1.71552776992141)

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -202,6 +202,9 @@ Core and Builtins Library ------- +- Issue #17149: Fix random.vonmisesvariate to always return results in