R Language Randomization


The R language is commonly used for statistical analysis. As such, it contains a robust set of options for randomization. For specific information on sampling from probability distributions, see the documentation for distribution functions.


Users who are coming from other programming languages may be confused by the lack of a rand function equivalent to what they may have experienced before. Basic random number generation is done using the r* family of functions for each distribution (see the link above). Random numbers drawn uniformly from a range can be generated using runif, for "random uniform". Since this also looks suspiciously like "run if", it is often hard to figure out for new R users.