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]  1.06365331  0.06274718  0.98492357  1.16700626 -1.90329250  0.76076741
#>  [7] -0.23922302 -0.03627662  1.41384359  2.17594017
rxnorm(n = 10, ncores = 2) # You can parallelize the simulation using openMP
#>  [1] -0.23843298 -0.05239444 -0.70639357 -0.14133078  1.05044169 -0.42083889
#>  [7] -1.51691623 -0.16579079  0.88339314 -1.17662267

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


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

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

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

s <- rxSolve(rx, et)
#>  
#>  
#>  parameter labels from comments are typically ignored in non-interactive mode
#>  Need to run with the source intact to parse comments
#>  
#>  
#> using C compiler: ‘gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0’

# }