bpo-41421: Algebraic simplification for random.paretovariate() (GH-21695)
This commit is contained in:
parent
cadda52d97
commit
5c3270939c
|
@ -749,7 +749,7 @@ class Random(_random.Random):
|
||||||
# Jain, pg. 495
|
# Jain, pg. 495
|
||||||
|
|
||||||
u = 1.0 - self.random()
|
u = 1.0 - self.random()
|
||||||
return 1.0 / u ** (1.0 / alpha)
|
return u ** (-1.0 / alpha)
|
||||||
|
|
||||||
def weibullvariate(self, alpha, beta):
|
def weibullvariate(self, alpha, beta):
|
||||||
"""Weibull distribution.
|
"""Weibull distribution.
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
Make an algebraic simplification to random.paretovariate(). It now is
|
||||||
|
slightly less subject to round-off error and is slightly faster. Inputs that
|
||||||
|
used to cause ZeroDivisionError now cause an OverflowError instead.
|
Loading…
Reference in New Issue