mirror of
https://github.com/python/cpython.git
synced 2025-08-28 20:56:54 +00:00
Issue #17149: Fix random.vonmisesvariate to always return results in [0, 2*math.pi].
This commit is contained in:
parent
497cee456c
commit
be5f91957f
3 changed files with 19 additions and 2 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue