Help › Functions
Random numbers
rnd runif rnorm rbeta rbinom rcauchy rchisq rexp rF rgamma rgeom rhypergeom rlnorm rlogis rnbinom rpois rt rweibull
rnd(x) As in Mathcad
A random number from 0 up to, but not including, x.
Every value in the range is equally likely. For a vector, gives one new number for each element. For many numbers at once, see runif; for a bell curve, rnorm. The numbers stay the same each time the worksheet calculates; Random numbers says how to draw new ones.
Units
The answer is in the units of x.
Refused
rnd(10)=
Random: the answer differs each time.
runif(m, a, b) As in Mathcad
A vector of m random numbers, evenly spread from a up to, but not including, b.
m is a whole number, 1 or more. For a single number scaled to a range, see rnd. The numbers stay the same each time the worksheet calculates; Random numbers says how to draw new ones.
Units
a and b must be in compatible units; the numbers take a's units.
Refused
- An m that isn't a whole number of 1 or more.
- Complex a or b, or a and b in different units.
runif(3,0,1)=
Random: the answer differs each time.
rnorm(m, μ, σ) As in Mathcad
A vector of m random numbers from a normal distribution with mean μ and standard deviation σ.
m is a whole number, 1 or more. About two thirds of the numbers fall within σ of μ. The numbers stay the same each time the worksheet calculates; Random numbers says how to draw new ones. For an even spread, see runif.
Units
μ and σ must be in compatible units; the numbers take μ's units.
Refused
- A negative σ.
- An m that isn't a whole number of 1 or more.
- Complex μ or σ, or μ and σ in different units.
rnorm(3,10,2)=
Random: the answer differs each time.
rbeta(m, s1, s2) As in Mathcad
A vector of m random numbers from the beta distribution.
S1 and s2 are its two shape parameters, both above 0. It lies between 0 and 1.
m is a whole number, 1 or more. The numbers stay the same each time the worksheet calculates; Random numbers says how to draw new ones. See also dbeta, pbeta, qbeta and rbeta.
rbeta(5,2,5)=
Random: the answer differs each time.
rbinom(m, n, p) As in Mathcad
A vector of m random numbers from the binomial distribution.
It counts The number of successes in n trials, each a success with probability p. n is a whole number, 1 or more.
m is a whole number, 1 or more. The numbers stay the same each time the worksheet calculates; Random numbers says how to draw new ones. See also dbinom, pbinom, qbinom and rbinom.
rbinom(5,10,0.3)=
Random: the answer differs each time.
rcauchy(m, l, s) As in Mathcad
A vector of m random numbers from the Cauchy distribution.
L is its location (the peak) and s its scale, above 0.
m is a whole number, 1 or more. The numbers stay the same each time the worksheet calculates; Random numbers says how to draw new ones. See also dcauchy, pcauchy, qcauchy and rcauchy.
rcauchy(5,0.5,2)=
Random: the answer differs each time.
rchisq(m, d) As in Mathcad
A vector of m random numbers from the chi-squared distribution.
D is its degrees of freedom, above 0.
m is a whole number, 1 or more. The numbers stay the same each time the worksheet calculates; Random numbers says how to draw new ones. See also dchisq, pchisq, qchisq and rchisq.
rchisq(5,3)=
Random: the answer differs each time.
rexp(m, r) As in Mathcad
A vector of m random numbers from the exponential distribution.
R is its rate, above 0; the mean is 1/r.
m is a whole number, 1 or more. The numbers stay the same each time the worksheet calculates; Random numbers says how to draw new ones. See also dexp, pexp, qexp and rexp.
rexp(5,2)=
Random: the answer differs each time.
rF(m, d1, d2) As in Mathcad
A vector of m random numbers from the F distribution.
D1 and d2 are its degrees of freedom, above 0.
m is a whole number, 1 or more. The numbers stay the same each time the worksheet calculates; Random numbers says how to draw new ones. See also dF, pF, qF and rF.
rF(5,4,7)=
Random: the answer differs each time.
rgamma(m, s) As in Mathcad
A vector of m random numbers from the gamma distribution.
S is its shape, above 0; its scale is 1, as in Mathcad. For a scale θ, divide x by θ (and the density by θ).
m is a whole number, 1 or more. The numbers stay the same each time the worksheet calculates; Random numbers says how to draw new ones. See also dgamma, pgamma, qgamma and rgamma.
rgamma(5,3)=
Random: the answer differs each time.
rgeom(m, p) As in Mathcad
A vector of m random numbers from the geometric distribution.
It counts The number of failures before the first success, each trial a success with probability p.
m is a whole number, 1 or more. The numbers stay the same each time the worksheet calculates; Random numbers says how to draw new ones. See also dgeom, pgeom, qgeom and rgeom.
rgeom(5,0.3)=
Random: the answer differs each time.
rhypergeom(m, a, b, n) As in Mathcad
A vector of m random numbers from the hypergeometric distribution.
It counts The number of successes in a sample of n, drawn without replacement from a successes and b failures.
m is a whole number, 1 or more. The numbers stay the same each time the worksheet calculates; Random numbers says how to draw new ones. See also dhypergeom, phypergeom, qhypergeom and rhypergeom.
rhypergeom(5,5,8,6)=
Random: the answer differs each time.
rlnorm(m, μ, σ) As in Mathcad
A vector of m random numbers from the lognormal distribution.
Μ and σ are the mean and standard deviation of its logarithm; σ is above 0.
m is a whole number, 1 or more. The numbers stay the same each time the worksheet calculates; Random numbers says how to draw new ones. See also dlnorm, plnorm, qlnorm and rlnorm.
rlnorm(5,0.2,0.8)=
Random: the answer differs each time.
rlogis(m, l, s) As in Mathcad
A vector of m random numbers from the logistic distribution.
L is its location and s its scale, above 0.
m is a whole number, 1 or more. The numbers stay the same each time the worksheet calculates; Random numbers says how to draw new ones. See also dlogis, plogis, qlogis and rlogis.
rlogis(5,0.5,2)=
Random: the answer differs each time.
rnbinom(m, n, p) As in Mathcad
A vector of m random numbers from the negative binomial distribution.
It counts The number of failures before the nth success, each trial a success with probability p. n is a whole number, 1 or more.
m is a whole number, 1 or more. The numbers stay the same each time the worksheet calculates; Random numbers says how to draw new ones. See also dnbinom, pnbinom, qnbinom and rnbinom.
rnbinom(5,4,0.6)=
Random: the answer differs each time.
rpois(m, λ) As in Mathcad
A vector of m random numbers from the Poisson distribution.
It counts The number of events in an interval where λ, above 0, are expected.
m is a whole number, 1 or more. The numbers stay the same each time the worksheet calculates; Random numbers says how to draw new ones. See also dpois, ppois, qpois and rpois.
rpois(5,3.5)=
Random: the answer differs each time.
rt(m, d) As in Mathcad
A vector of m random numbers from Student's t distribution.
D is its degrees of freedom, above 0.
m is a whole number, 1 or more. The numbers stay the same each time the worksheet calculates; Random numbers says how to draw new ones. See also dt, pt, qt and rt.
rt(5,4)=
Random: the answer differs each time.
rweibull(m, s) As in Mathcad
A vector of m random numbers from the Weibull distribution.
S is its shape, above 0; its scale is 1, as in Mathcad. For a scale λ, divide x by λ (and the density by λ).
m is a whole number, 1 or more. The numbers stay the same each time the worksheet calculates; Random numbers says how to draw new ones. See also dweibull, pweibull, qweibull and rweibull.
rweibull(5,2)=
Random: the answer differs each time.