Simulate random normal variable from threefry/vandercorput generator

rxnorm(mean = 0, sd = 1, n = 1L, ncores = 1L)

rxnormV(mean = 0, sd = 1, n = 1L, ncores = 1L)

Arguments

mean

vector of means.

sd

vector of standard deviations.

n

number of observations

ncores

Number of cores for the simulation

rxnorm simulates using the threefry sitmo generator; rxnormV uses the vandercorput generator

Value

normal random number deviates

Examples

# \donttest{
## Use threefry engine

rxnorm(n = 10) # with rxnorm you have to explicitly state n
#>  [1] -2.8807429 -0.1678537  0.6332729  0.7161145  0.4543867 -0.4340744
#>  [7] -0.2305373  0.3204707  1.6692535  0.3048113
rxnorm(n = 10, ncores = 2) # You can parallelize the simulation using openMP
#>  [1] -0.1558854  0.3961505 -0.7778066 -0.2628406 -0.6837131 -0.1957431
#>  [7] -1.6115893  0.7430801 -1.1665228 -1.7312264

rxnorm(2, 3) ## The first 2 arguments are the mean and standard deviation
#> [1] -0.534782


## This example uses `rxnorm` directly in the model

rx <- RxODE({
  a <- rxnorm()
})
#>  

et <- et(1, id = 1:2)

s <- rxSolve(rx, et)

## Use vandercorput generator

rxnormV(n = 10) # with rxnorm you have to explicitly state n
#>  [1] -0.39234507  0.53917036 -0.09647992  1.72474694 -1.71178296  0.07276450
#>  [7] -0.53909037  0.38449969 -1.31794264  1.55198378
rxnormV(n = 10, ncores = 2) # You can parallelize the simulation using openMP
#>  [1] -1.8015773  1.8246042  0.7963448 -1.8015773 -0.4719304  0.7963448
#>  [7]  0.5166386 -0.4719304 -0.4376811  0.5166386

rxnormV(2, 3) ## The first 2 arguments are the mean and standard deviation
#> [1] -3.214173


## This example uses `rxnormV` directly in the model

rx <- RxODE({
  a <- rxnormV()
})
#>  

et <- et(1, id = 1:2)

s <- rxSolve(rx, et)
# }