On this page
random.gammavariate
Prev: random.expovariate | Up: random | Next: random.gauss
Rel: random.betavariate, random.binomialvariate, random.choice, random.choices
Ref: docs.python.org — random.gammavariate
Tags: #public #python3 #stdlib #random
Import
import random
from random import gammavariate
Signature & Overview
random.gammavariate(alpha, beta)
Gamma distribution. Not the gamma function! Conditions on the parameters are alpha > 0 and beta > 0.
Usage
import random
rng = random.Random(1)
x = rng.gammavariate(alpha=2.0, beta=1.5)
assert x > 0.0
Gotchas
- Note scale vs. rate convention: Here
mean = alpha * beta(sobetais the scale parameter, not the rate).
REPL Inspect
from random import gammavariate
help(gammavariate)
Linked from
Related notes
- tuts/python3/stdlib_module/random/expovariate Linked here; links to this page; shared tags: #random, #stdlib
- tuts/python3/stdlib_module/random/gauss 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/getrandbits shared tags: #random, #stdlib
- tuts/python3/stdlib_module/random/getstate shared tags: #random, #stdlib