17
$\begingroup$

What is the difference between the functions rnorm and runif in R?

$\endgroup$
2
  • $\begingroup$ Welcome to the site, @SrinivasaReddyChalla. It's not clear to me that this question is on-topic here (see our FAQ). Are you wondering about the differences b/t the normal and uniform distributions? or about the nature of pseudorandom generation? $\endgroup$ Feb 6 '13 at 2:39
  • 3
    $\begingroup$ @SrinivasaReddyChalla, you can check the documentation of any R function via the syntax ?somefunction. For example, to check the documentation for runif: open up an R session and type ?runif. $\endgroup$ Feb 6 '13 at 3:15
23
$\begingroup$

rnorm generates a random value from the normal distribution. runif generates a random value from the uniform.

$\endgroup$
16
$\begingroup$

rnorm(n, mean = , sd = ) is used to generate n normal random numbers with arguments mean and sd; while runif(n, min = , max = ) is used to generate n uniform random numbers lie in the interval (min, max).

Please check corresponding R help documents for details.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.