[R] generate random number

Bill Simpson wsi at gcal.ac.uk
Wed Mar 21 09:57:36 CET 2001


> I want to pick 3 "integer" random numbers from 1 to
> 10. How to do this?
If you mean sampling without replacement:
sample(1:10,3,replace=FALSE)
If you mean with replacement:
sample(1:10,3,replace=TRUE)

Bill

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list