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]  0.37076053 -0.96034099  0.02749010 -0.82762453  0.58984915 -1.80511477
#>  [7]  0.50379739 -0.67643890  1.45510439  0.04165521
rxnorm(n = 10, ncores = 2) # You can parallelize the simulation using openMP
#>  [1] -0.51162593 -1.13782819  0.06566640 -0.12404287  1.79306612  0.83099897
#>  [7] -0.44485847  0.06223717  1.88310497  0.22993201

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


## 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’

# }