On this page
random.gauss
Prev: random.gammavariate | Up: random | Next: random.getrandbits
Rel: random.betavariate, random.binomialvariate, random.choice, random.choices
Ref: docs.python.org — random.gauss
Tags: #public #python3 #stdlib #random
Import
import random
from random import gauss
Signature & Overview
random.gauss(mu=0.0, sigma=1.0)
Gaussian distribution.
Usage
import random
rng = random.Random(1)
x = rng.gauss(mu=0.0, sigma=1.0)
assert isinstance(x, float)
Gotchas
- Faster than
normalvariate(), but NOT thread-safe on a shared instance:gauss()caches a second variate internally; use a per-threadRandominstance ornormalvariate()if sharing across threads.
REPL Inspect
from random import gauss
help(gauss)
Linked from
Related notes
- tuts/python3/stdlib_module/random/gammavariate Linked here; links to this page; shared tags: #random, #stdlib
- tuts/python3/stdlib_module/random/getrandbits 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/getstate shared tags: #random, #stdlib