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

______________________________________________
R-help@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.

Reply via email to