On this page
random.triangular
Prev: random.SystemRandom | Up: random | Next: random.uniform
Rel: random.betavariate, random.binomialvariate, random.choice, random.choices
Ref: docs.python.org — random.triangular
Tags: #public #python3 #stdlib #random
Import
import random
from random import triangular
Signature & Overview
random.triangular(low=0.0, high=1.0, mode=None)
Triangular distribution.
Usage
import random
rng = random.Random(1)
x = rng.triangular(low=1.0, high=10.0, mode=3.0)
assert 1.0 <= x <= 10.0
Gotchas
- Handy for quick PERT/estimate simulations: Defaults to
low=0.0, high=1.0, mode=midpoint.
REPL Inspect
from random import triangular
help(triangular)
Linked from
Related notes
- tuts/python3/stdlib_module/random/SystemRandom Linked here; links to this page; shared tags: #random, #stdlib
- tuts/python3/stdlib_module/random/uniform Linked here; links to this page; shared tags: #random, #stdlib
- tuts/python3/stdlib_module/random/betavariate Linked here; shared tags: #random, #stdlib
- tuts/python3/stdlib_module/random/binomialvariate Linked here; shared tags: #random, #stdlib
- tuts/python3/stdlib_module/random/choice Linked here; shared tags: #random, #stdlib
- tuts/python3/stdlib_module/random/choices Linked here; shared tags: #random, #stdlib
- tuts/python3/stdlib_module/random/random Linked here; shared tags: #random, #stdlib
- tuts/python3/stdlib_module/random links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/random/expovariate shared tags: #random, #stdlib
- tuts/python3/stdlib_module/random/gammavariate shared tags: #random, #stdlib