random_number_generator {EnviroPRA2}R Documentation

Random number generator

Description

Return a vector of n random numbers following a truncated distribution (dist) in agreement with a fitted parameters "Fited"

Usage

random_number_generator(n, Fited, dist, a, b)

Arguments

n

The number of desired generated numbers

Fited

A list contaning the parameters obtained by application of Fit_dist_parameter

dist

Character vector indicating the distribution to be applied:"norm", "lnorm", "geom", "exp", "pois", "cauchy", "logis", "weibull"

a

Truncation Lower limit

b

Truncation Upper limit

Value

A vector of n random numbers - Object class "numeric"

Author(s)

F. Barrio-Parra

See Also

Fit_dist_parameter

Examples


set.seed(123)
a <- rnorm(n = 100, mean = 10, sd = 1)
Fit <- Fit_dist_parameter(a)

b <-random_number_generator(n = 10000, Fited = Fit, 
                            dist = "norm", a =8, b = 12)

hist(a,xlim= c(7,14))
hist(b,xlim= c(7,14))

[Package EnviroPRA2 version 1.0.1 Index]