Generates a set of Normally distributed values.

r_norm(mean = 0, sd = 1, ..., n = default_n(mean, sd), .seed = NULL)

Arguments

mean

vector of means

sd

vector of standard deviations, strictly positive

...

Unused

n

number of observations to generate. The default_n() function will provide a default value within context

.seed

One of the following:

  • NULL (default) will not change the current seed. This is the usual case for generating random numbers.

  • A numeric value. This will be used to set the seed before generating the random numbers. This seed will be stored with the results.

  • TRUE. A random seed value will be generated and set as the seed before the results are generated. Again, this will be stored with the results.

To extract the random seed from a previously generated set of values, use pull_seed()

Value

A numeric vector of length n

Examples

set_n(5) r_norm(10)
#> [1] 11.369776 9.979890 9.890782 10.264662 10.303848
r_norm(10, 2)
#> [1] 9.633223 11.119299 9.626892 8.375449 6.718837
r_norm(1:10)
#> [1] 1.507922 3.754337 3.592400 5.016713 5.121621 4.921933 5.856434 7.470356 #> [9] 8.318727 9.797552
r_norm(-2, n = 10)
#> [1] -0.3155043 -3.0337732 -2.1559767 -2.0464006 -2.9536287 -1.5837392 #> [7] -1.8859704 -1.9360812 -2.9193322 -1.0986647