[R] random number generation
Adaikalavan Ramasamy
gisar at nus.edu.sg
Fri Jan 3 03:12:03 CET 2003
Many ways of doing this. Try rbinom(n=1, size=1, prob=0.5) and you can
adjust the 'prob' argument if you have an unfair coin. The other one is
sample( c(0,1), 1 ) which is a sampling method and also has a 'prob'
argument. Other functions include rnorm, runif, rpois ....
-----Original Message-----
From: Joshua Gramlich [mailto:jgramlich at piocon.com]
Sent: Friday, January 03, 2003 5:59 AM
To: r-help at stat.math.ethz.ch
Subject: [R] random number generation
Can a single random number be generated in R? I have an exercise that
wants to simulate coin tosses, and I cannot seem to find a good example
of the use of random number generation in R. Any help?
Joshua Gramlich
Chicago, IL
______________________________________________
R-help at stat.math.ethz.ch mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help
More information about the R-help
mailing list