merge
This commit is contained in:
commit
d58a0b6876
|
@ -355,7 +355,10 @@ class Random(_random.Random):
|
|||
|
||||
"""
|
||||
u = self.random()
|
||||
c = 0.5 if mode is None else (mode - low) / (high - low)
|
||||
try:
|
||||
c = 0.5 if mode is None else (mode - low) / (high - low)
|
||||
except ZeroDivisionError:
|
||||
return low
|
||||
if u > c:
|
||||
u = 1.0 - u
|
||||
c = 1.0 - c
|
||||
|
|
|
@ -602,7 +602,7 @@ class TestDistributions(unittest.TestCase):
|
|||
for variate, args, expected in [
|
||||
(g.uniform, (10.0, 10.0), 10.0),
|
||||
(g.triangular, (10.0, 10.0), 10.0),
|
||||
#(g.triangular, (10.0, 10.0, 10.0), 10.0),
|
||||
(g.triangular, (10.0, 10.0, 10.0), 10.0),
|
||||
(g.expovariate, (float('inf'),), 0.0),
|
||||
(g.vonmisesvariate, (3.0, float('inf')), 3.0),
|
||||
(g.gauss, (10.0, 0.0), 10.0),
|
||||
|
|
Loading…
Reference in New Issue