Learn R Programming

ramify (version 0.1.0)

rand: Matrix of Random Numbers

Description

Construct a matrix of random deviates.

Usage

rand(nrow = 1, ncol = 1, ...)

randn(nrow = 1, ncol = 1, ...)

Arguments

nrow
The desired number of rows.
ncol
The desired number of columns.
...
Additional optional arguments to be passed on to runif or rnorm.

Value

  • An nrow-by-ncol matrix of pseudorandom numbers.

Details

rand generates a matrix of uniform random deviates while randn generates a matrix of normal random deviates.

See Also

runif, rnorm.

Examples

Run this code
rand(2, 3)  # 2-by-3 matrix of uniform random numbers
rand(2, 3, min = 100, max = 200)
randn(2, 3)  # 2-by-3 matrix of standard normal random variates
randn(2, 3, mean = 10, sd = 0.1)

Run the code above in your browser using DataLab