rnorm in r

The function rnorm in R is used to generate random numbers from a normal distribution. It takes the following arguments:

  1. n: This specifies the number of random numbers to generate.

  2. mean: This specifies the mean of the normal distribution.

  3. sd: This specifies the standard deviation of the normal distribution.

Here is an example of how to use the rnorm function in R:

# Generate 100 random numbers from a normal distribution with mean 0 and standard deviation 1
random_numbers <- rnorm(n = 100, mean = 0, sd = 1)

In this example, we are generating 100 random numbers from a normal distribution with a mean of 0 and a standard deviation of 1. The generated random numbers are stored in the variable random_numbers.