rnorm() — Random normal samples

Pulls out random numbers that follow the bell-shaped pattern.

rnorm(n, mean = 0, sd = 1)

Key idea

Definition

how many values to draw
the mean
the standard deviation
a normal distribution

In plain words

Like a bag full of heights that bunch up around the middle. You reach in and grab n of them without looking. The seed — a starting number — makes sure you grab the same ones each time, so the result can be repeated.

Where you'd use it

Frequently asked questions

Why do I get different numbers every run?
rnorm draws random samples. Call set.seed(n) first to make them reproducible.
How do I set the centre and spread?
rnorm(n, mean, sd) — the 2nd/3rd args. sd is the standard deviation, not the variance.