2019-12-17 15:34:47 +01:00
|
|
|
#' @title Generate matrix with U(0, 1) trials
|
|
|
|
|
#' @description Imitates the behavior of `rand()` on Matlab
|
|
|
|
|
#' @param r number of rows of output matrix
|
|
|
|
|
#' @param c number of columns of output matrix
|
|
|
|
|
#' @return \eqn{r \times c} matrix with random trials from a standard uniform distribution.
|
|
|
|
|
#' @importFrom stats runif
|
2020-01-14 16:37:00 +01:00
|
|
|
#' @export
|
2019-12-17 15:34:47 +01:00
|
|
|
rand <- function(r = 1, c = 1) {
|
2021-11-10 14:02:35 +01:00
|
|
|
matrix(runif(r * c), r, c)
|
|
|
|
|
}
|