2.8 The random module

The random module contains function for generating random samples from probability distributions:

random.binomial($$p,n$)$
The random.binomial($$p,n$) function returns a random sample from a binomial distribution with $n$ independent trials and a success probability $p$. $n$ must be a real positive dimensionless integer. $p$ must be a dimensionless number in the range $0≤p≤1$. $

random.chisq($$ν$)$
The random.chisq($$ν$) function returns a random sample from a $χ$-squared distribution with $ν$ degrees of freedom, where $ν$ must be a real positive dimensionless integer. $

random.gaussian($$σ$)$
The random.gaussian($$σ$) function returns a random sample from a Gaussian (normal) distribution of standard deviation $σ$ and centred upon zero. $σ$ must be real, but may have any physical units. The returned random sample shares the physical units of $σ$. $

random.lognormal($$ζ,σ$)$
The random.lognormal($$ζ,σ$) function returns a random sample from the log normal distribution centred on $ζ$, and of width $σ$. $σ$ must be a real positive dimensionless number. $ζ$ must be real, but may have any physical units. The returned random sample shares the physical units of $ζ$. $

random.poisson($$n$)$
The random.poisson($$n$) function returns a random integer from a Poisson distribution with mean $n$, where $n$ must be a real positive dimensionless number. $

random.random()
The random.random() function returns a random real number between 0 and 1.

random.tdist($$ν$)$
The random.tdist($$ν$) function returns a random sample from a $t$-distribution with $ν$ degrees of freedom, where $ν$ must be a real positive dimensionless integer. $