[R] Generating Numbers With Certain Distribution in R

Ben Bolker bolker at ufl.edu
Wed Feb 11 14:15:45 CET 2009


Bernardo Rangel Tura wrote:

> I think your routine need a little fix
> 
> x <- rlnorm(1e6,meanlog=1,sdlog=1) ## pick any parameters you like
> y <- round((x-min(x)/diff(range(x)))*199999+1)
> 
> What you think?

  Yes.




More information about the R-help mailing list