# [R] random number 0-1

Ko-Kang Wang Ko-Kang at xtra.co.nz
Thu Apr 20 12:45:55 CEST 2000

```There are many ways to do this.
rnorm generates random numbers using normal distribution generator.
runif generates random numbers using uniform distribution generator, which by
default ranges from 0 ~ 1.

I believe "runif()" would be the one you want, althought here are many other
distribution like binomial and poisson.  To use runif, obviously you can read the
documentation by typing:
> ?runif

However, it works basically as:
runif(n, min=0, max=1)
where n is the number of random numbers you want, min=0, max=1 means you want them
to be generated through the uniform distribution generator, between 0 and 1 (they
are the default).

Cheers,

Ko-Kang Wang

nicolas baurin wrote:

> Hello,
>
> i'm looking for the procedure to generate a random number between 0-1.
> Try rnorm() but can't get to do generate between 0-1
>
> thanks(i'm sur it's easy)
>
> --
> Nicolas Baurin
>
> Doctorant
> Institut de Chimie Organique et Analytique, UPRES-A 6005
> Université d'Orléans, BP 6759
> 45067 ORLEANS Cedex 2, France
> Tel: (33+) 2 38 49 45 77
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```