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

This commit is contained in:
Mark Dickinson 2013-02-10 14:16:10 +00:00
parent 497cee456c
commit be5f91957f
3 changed files with 19 additions and 2 deletions

View file

@ -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