summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_random.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2008-03-23 13:32:32 (GMT)
committerRaymond Hettinger <python@rcn.com>2008-03-23 13:32:32 (GMT)
commitbbc50eafe5cc7d2fa73b5b45eebc573c600db9ac (patch)
tree14d5116b591f743db3921087895b0710ff20312d /Lib/test/test_random.py
parent9a0d3462fcac06cb257b77cad464d01d348f702c (diff)
downloadcpython-bbc50eafe5cc7d2fa73b5b45eebc573c600db9ac.zip
cpython-bbc50eafe5cc7d2fa73b5b45eebc573c600db9ac.tar.gz
cpython-bbc50eafe5cc7d2fa73b5b45eebc573c600db9ac.tar.bz2
Issue 1681432: Add triangular distribution the random module.
Diffstat (limited to 'Lib/test/test_random.py')
-rw-r--r--Lib/test/test_random.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/test/test_random.py b/Lib/test/test_random.py
index 86e2e64..07e12d3 100644
--- a/Lib/test/test_random.py
+++ b/Lib/test/test_random.py
@@ -488,6 +488,7 @@ class TestDistributions(unittest.TestCase):
g.random = x[:].pop; g.gammavariate(1.0, 1.0)
g.random = x[:].pop; g.gammavariate(200.0, 1.0)
g.random = x[:].pop; g.betavariate(3.0, 3.0)
+ g.random = x[:].pop; g.triangular(0.0, 1.0, 1.0/3.0)
def test_avg_std(self):
# Use integration to test distribution average and standard deviation.
@@ -497,6 +498,7 @@ class TestDistributions(unittest.TestCase):
x = [i/float(N) for i in xrange(1,N)]
for variate, args, mu, sigmasqrd in [
(g.uniform, (1.0,10.0), (10.0+1.0)/2, (10.0-1.0)**2/12),
+ (g.triangular, (0.0, 1.0, 1.0/3.0), 4.0/9.0, 7.0/9.0/18.0),
(g.expovariate, (1.5,), 1/1.5, 1/1.5**2),
(g.paretovariate, (5.0,), 5.0/(5.0-1),
5.0/((5.0-1)**2*(5.0-2))),