This function wraps a call to the standard Octave
function randn
, which is redefined by
RcppOctave
to call the R base function
rnorm
. This enables to exactly
reproduce stochastic computations in R and Octave,
without changing the original Octave/Matlab code. See
o_runif
for more details.
o_rnorm(n, p = n)
n
)USAGE: N = randn( n [, k]) Generates standard-normal random variates as R function 'rnorm' -- using the current RNG from R. Possible calls: randn(n, k) returns a n*k matrix with uncorrelated N(0, 1) deviates drawn in columns randn(n) returns a n*n matrix with uncorrelated N(0, 1) deviates draw in columns NOTE: This function substitutes Octave original function in calls from RcppOctave
[Generated from Octave-3.6.4 on 2014-05-21 11:08:20 ]
## Don't show:
# roxygen generated flag
options(R_CHECK_RUNNING_EXAMPLES_=TRUE)
## End Don't show
# Draw random normal values (in vector form)
set.seed(123)
o_rnorm(1)
## [1] -0.5605
o_rnorm(1, 10)
## [1] -0.23018 1.55871 0.07051 0.12929 1.71506 0.46092 -1.26506
## [8] -0.68685 -0.44566 1.22408
# Draw random normal values (in matrix form)
set.seed(123)
o_rnorm(2)
## [,1] [,2]
## [1,] -0.5605 1.55871
## [2,] -0.2302 0.07051
o_rnorm(2, 5)
## [,1] [,2] [,3] [,4] [,5]
## [1,] 0.1293 0.4609 -0.6869 1.2241 0.4008
## [2,] 1.7151 -1.2651 -0.4457 0.3598 0.1107