What is the difference between runif () and rnorm () functions in R

What is the difference between runif () and rnorm () functions in R


  R Interview Questions

RUNIF ()

runif function generates a list of random numbers between an interval. For example,

# Generates 100 random numbers between 0 and 100
> runif(100, min = 0, max = 100)

RNORM ()

rnorm function generates a set of random numbers with a defined mean and standard deviation. For example,

# Generates 100 random numbers with a mean of 100 and standard deviation of 10
> rnorm(100,mean=100,sd=10)

Click here if you want togenerate the same set of random numbers every time in R ( Useful during testing )

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: