summaryrefslogtreecommitdiff
path: root/Lib/random.py
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2013-02-10 14:13:40 +0000
committerMark Dickinson <dickinsm@gmail.com>2013-02-10 14:13:40 +0000
commit9aaeb5e0c8b5946b305590eb85312c282a457098 (patch)
tree9d28f5d2ab197b561c907d1fafdf5e36bb174071 /Lib/random.py
parentf898038ca06f50fd328e0cd0eb5e5b9383b90680 (diff)
downloadcpython-git-9aaeb5e0c8b5946b305590eb85312c282a457098.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 36b956540b..bfa710be86 100644
--- a/Lib/random.py
+++ b/Lib/random.py
@@ -475,9 +475,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