Learn R Programming

tigerstats (version 0.3.2)

random_normal_factory: Make Normal Sampling Functions

Description

Makes a function that samples from a normal distribution.

Usage

random_normal_factory(mean, sd)

Arguments

mean

mean of normal distribution from which to sample

sd

standard deviation of the normal distribution

Value

a function of a single parameter n, with default value 1.

Examples

Run this code
# NOT RUN {
sampler <- random_normal_factory(mean = 70, sd = 5)
## sample one
sampler()
## sample another
sampler()
## sample a third time
sampler()
## sample another 1000
sampler(n = 1000)
# }

Run the code above in your browser using DataLab