summaryrefslogtreecommitdiff
path: root/Lib/random.py
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2013-02-10 14:16:10 +0000
committerMark Dickinson <dickinsm@gmail.com>2013-02-10 14:16:10 +0000
commitbe5f91957f3d553a7cbbfdc43f66a3b30bb97aec (patch)
tree0f6473d649766c9b0dfe61e7d828d8730e0bc46a /Lib/random.py
parent497cee456c29202918739275fcc3d1bd0183ae06 (diff)
downloadcpython-git-be5f91957f3d553a7cbbfdc43f66a3b30bb97aec.tar.gz
Issue #17149: Fix random.vonmisesvariate to always return results in [0, 2*math.pi].
Diffstat (limited to 'Lib/random.py')
-rw-r--r--Lib/random.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/random.py b/Lib/random.py
index 9b61208d2e..4cbe9ade43 100644
--- a/Lib/random.py
+++ b/Lib/random.py
@@ -449,9 +449,9 @@ class Random(_random.Random):
u3 = random()
if u3 > 0.5:
- theta = (mu % TWOPI) + _acos(f)
+ theta = (mu + _acos(f)) % TWOPI
else:
- theta = (mu % TWOPI) - _acos(f)
+ theta = (mu - _acos(f)) % TWOPI
return theta