A bounded version of rnorm

rnorm_bounded(n, mean = 0, sd = 1, min = -Inf, max = Inf)

Arguments

n

number of observations. If length(n) > 1, the length is taken to be the number required.

mean

vector of means.

sd

vector of standard deviations.

min

lower limits of the distribution.

max

upper limits of the distribution.

Value

Generates values with rnorm, bounded by [min, max]

Examples

rnorm_bounded(10)
#> [1] -0.962463043 0.136375306 0.872982292 0.482882215 -1.223164572 #> [6] -0.240242667 -0.009584396 0.045820880 -1.052877964 -0.283223345