Skip to contents

Simulate random normal variable from threefry generator

Usage

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

rxnorm(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 used to simulate with the vandercorput simulator, but since it didn't satisfy the normal properties it was changed to simple be an alias of rxnorm. It is no longer supported in rxode2({}) blocks

Value

normal random number deviates

Examples

# \donttest{
## Use threefry engine

rxnorm(n = 10) # with rxnorm you have to explicitly state n
#>  [1] -2.6817673  0.8554461  0.4133826  0.1191307  0.3358854  0.1156384
#>  [7] -0.7709678  1.4194880  0.2460745 -1.2046462
rxnorm(n = 10, ncores = 2) # You can parallelize the simulation using openMP
#>  [1] -0.03174209  0.70704969  0.05737630 -0.82448386  0.94143649 -0.58478385
#>  [7]  1.08952291 -1.62128318 -0.40198763  0.15497883

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


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

rx <- function() {
  model({
    a <- rxnorm()
  })
}

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

s <- rxSolve(rx, et)
#>  
#>  
#>  
#>  
#> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’

# }