rnorm_bounded: Helper function for random number generation

View source: R/tools.r

rnorm_boundedR Documentation

Helper function for random number generation

Description

Takes an intended range of values for the property and returns a randomly instantiated value.

Usage

rnorm_bounded(min = 0, max = 1, n_sigma = 2)

Arguments

min

The lower boundary of the interval to be sampled from.

max

The upper boundary of the interval to be sampled from.

n_sigma

An integer number indicating the range of the Gaussian distribution be accepted without resampling.

Details

This function considers the given range [min, max] to be the n-sigma range of a Gaussian probability distribution, with the mean lying in the center of the range. Samples outside of this interval (i.e. outside of the n-sigma range, hence e.g. less than 5% of all samples for n = 2) are rejected and resampled.

Value

A single numerical value lying in the given interval.


ime-luebeck/semgsim documentation built on April 14, 2022, 11:02 p.m.