[R] random numbers between 0 and 1

Erik Iverson eiverson at NMDP.ORG
Wed Oct 21 21:30:34 CEST 2009


Uniformly distributed random numbers between 0 and 1?  Try ?runif 

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
> On Behalf Of carol white
> Sent: Wednesday, October 21, 2009 2:26 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] random numbers between 0 and 1
> 
> Hi,
> To generate random numbers between 0 and 1, do you use rnorm followed by
> dnrom? for ex, for 10 variables
> 
> a = rnorm(10)
> > a
>  [1] -0.87640764 -0.95842391 -1.33434559 -0.63844932 -1.69829393
> 0.80010865
>  [7] -0.01026882 -0.23887516  2.29912600 -1.38352143
> > dnorm(a)
>  [1] 0.27171985 0.25202507 0.16378878 0.32538464 0.09432211 0.28966637
>  [7] 0.39892125 0.38772103 0.02838403 0.15320103
> 
> 
> Regards,
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list