Uniform {stats}  R Documentation 
These functions provide information about the uniform distribution
on the interval from min
to max
. dunif
gives the
density, punif
gives the distribution function qunif
gives the quantile function and runif
generates random
deviates.
dunif(x, min = 0, max = 1, log = FALSE)
punif(q, min = 0, max = 1, lower.tail = TRUE, log.p = FALSE)
qunif(p, min = 0, max = 1, lower.tail = TRUE, log.p = FALSE)
runif(n, min = 0, max = 1)
x, q 
vector of quantiles. 
p 
vector of probabilities. 
n 
number of observations. If 
min, max 
lower and upper limits of the distribution. Must be finite. 
log, log.p 
logical; if TRUE, probabilities p are given as log(p). 
lower.tail 
logical; if TRUE (default), probabilities are

If min
or max
are not specified they assume the default
values of 0
and 1
respectively.
The uniform distribution has density
f(x) = \frac{1}{maxmin}
for min \le x \le max
.
For the case of u := min == max
, the limit case of
X \equiv u
is assumed, although there is no density in
that case and dunif
will return NaN
(the error condition).
runif
will not generate either of the extreme values unless
max = min
or maxmin
is small compared to min
,
and in particular not for the default arguments.
dunif
gives the density,
punif
gives the distribution function,
qunif
gives the quantile function, and
runif
generates random deviates.
The length of the result is determined by n
for
runif
, and is the maximum of the lengths of the
numerical arguments for the other functions.
The numerical arguments other than n
are recycled to the
length of the result. Only the first elements of the logical
arguments are used.
The characteristics of output from pseudorandom number generators
(such as precision and periodicity) vary widely. See
.Random.seed
for more information on R's random number
generation algorithms.
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
RNG
about random number generation in R.
Distributions for other standard distributions.
u < runif(20)
## The following relations always hold :
punif(u) == u
dunif(u) == 1
var(runif(10000)) # ~ = 1/12 = .08333