rand
,
which is redefined by RcppOctave
to call the R base function
runif
.
This enables to exactly reproduce stochastic computations in R and Octave,
without changing the original Octave/Matlab code.o_runif(n, p = n)
n
)o_runif
or runif
is equivalent, this
function may not be really useful for the end user, and is defined for
testing purposes essentially.
One possible advantage over plain runif
however, is that it
can generate random matrices, instead of only vectors (see examples).set.seed
.RcppOctave
defines a set of functions like rand
that shadow
Octave built-in functions.
These functions are defined in the Octave module Rrng.oct
that is
stored in the package modules/ sub-directory.
See Octave.info('modules')
to see this directory's full path.[Generated from Octave-
# Draw random uniform values (in vector form) set.seed(123) o_runif(1) o_runif(1, 10) # The result is identical as calling runif set.seed(123) runif(1) runif(10)
# Draw random uniform values (in matrix form) set.seed(123) o_runif(2) o_runif(2, 5)