Generate random samples from a standardized normal distribution and return in matrix form.
Arguments
- dim1
The dimension of the matrix (if square), otherwise the number of rows.
- dim2
The number of columns, if different from the number of rows.
Examples
randn(2,3)
#> [,1] [,2] [,3]
#> [1,] -0.8044991 -1.177204 -0.6943152
#> [2,] 1.0266343 1.301041 -0.3033199
randn(5)
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 1.7078326 1.27976710 -0.4375328 1.0382047 0.88649102
#> [2,] -0.3169546 0.02908439 -0.8290340 0.5841408 -2.55506749
#> [3,] -0.4499394 1.66821967 -0.1820818 -0.7740895 -0.80870346
#> [4,] -0.1188688 0.24833575 0.5904577 0.1755050 -0.04898549
#> [5,] 0.4395563 0.09052064 -0.9546829 -0.5999612 0.26780835