[R] generate random numbers for lotteries
Mike Miller
mbmiller+l at gmail.com
Mon Apr 30 04:33:22 CEST 2012
On Sun, 29 Apr 2012, Daniel Nordlund wrote:
> I don't know what the OP is really trying to accomplish yet, and I am
> not motivated (yet) to try to figure it out. However, all this
> "flooring" and "ceiling) and "rounding" is not necessary for generating
> uniform random integers. For N integers in the range from A to B it is
> as simple as
>
> sample(A:B, N, replace=TRUE)
That is easier to work with. Thanks. Jim Holtman also was pointing to
the sample() function. I'm used to making all random numbers from runif()
because I use that kind of tactic in a lot of different languages.
Sample() is faster, too.
Mike
More information about the R-help
mailing list