This function generates random values from the random variable.
Arguments
- n
Integer. Number of observations.
- mu
Numeric. If it is provided and has length
n
, values will be used in each realization.- sigma
Numeric. If it is provided and has length
n
, values will be used in each realization.
Examples
test <- rand_normal(mu = 1, sigma = 2)
test$gen(10)
#> [1] -0.8857216 3.8146824 1.7406460 2.6620003 4.0644920 1.7348785
#> [7] -0.8010374 1.7234418 2.2915657 2.2673275
test$gen(3, mu = c(0,1,2), sigma = c(1,2,4))
#> [1] -0.4565394 2.5225371 4.3377065