| vunif | R Documentation | 
Variate Generation for Uniform Distribution
vunif(n, min = 0, max = 1, stream = NULL, antithetic = FALSE, asList = FALSE)
| n | number of observations | 
| min | lower limit of distribution (default 0) | 
| max | upper limit of distribution (default 1) | 
| stream | if  | 
| antithetic | if  | 
| asList | if  | 
Generates random variates from the uniform distribution.
Uniform variates are generated by inverting uniform(0,1) variates
produced either by stats::runif (if stream is
NULL) or by rstream.sample
(if stream is not NULL).
In either case, stats::qunif is used to
invert the uniform(0,1) variate(s).
In this way, using vunif provides a monotone and synchronized
binomial variate generator, although not particularly fast.
The stream indicated must be an integer between 1 and 25 inclusive.
The uniform distribution has density
      \deqn{f(x) = \frac{1}{max-min}}{
                f(x) = 1/(max-min)}
for min \le x \le max.
If asList is FALSE (default), return a vector of random variates.
Otherwise, return a list with components suitable for visualizing inversion, specifically:
| u | A vector of generated U(0,1) variates | 
| x | A vector of uniform random variates | 
| quantile | Parameterized quantile function | 
| text | Parameterized title of distribution | 
Barry Lawson (blawson@bates.edu), 
Larry Leemis (leemis@math.wm.edu), 
Vadim Kudlay (vkudlay@nvidia.com)
rstream, set.seed,
stats::runif
stats::runif
 set.seed(8675309)
 # NOTE: following inverts rstream::rstream.sample using stats::qunif
 vunif(3, min = -2, max = 2)
 set.seed(8675309)
 # NOTE: following inverts rstream::rstream.sample using stats::qunif
 vunif(3, 0, 10, stream = 1)
 vunif(3, 0, 10, stream = 2)
 set.seed(8675309)
 # NOTE: following inverts rstream::rstream.sample using stats::qunif
 vunif(1, 0, 10, stream = 1)
 vunif(1, 0, 10, stream = 2)
 vunif(1, 0, 10, stream = 1)
 vunif(1, 0, 10, stream = 2)
 vunif(1, 0, 10, stream = 1)
 vunif(1, 0, 10, stream = 2)
 set.seed(8675309)
 variates <- vunif(100, 0, 10, stream = 1)
 set.seed(8675309)
 variates <- vunif(100, 0, 10, stream = 1, antithetic = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.