[R] Choosing a random number between x and y
Dieter Menne
dieter.menne at menne-biomed.de
Mon Feb 9 20:17:18 CET 2009
Vie <wxv579 <at> bham.ac.uk> writes:
>
> Ive been trying to find a function that will allow me to pull out a number
> between a minimum and maximum threshold.
>
> I want a random decimal number between, for example, 0 and 0.5 or 0 and 0.7.
> I've been searching everywhere for a function that will allow me to do this
> in R, but I have yet to be successful. Any help would be much appreciated.
assuming you want uniform distribution
?runif
These functions provide information about the uniform distribution on the
interval from min to max. dunif gives the density, punif gives the distribution
function qunif gives the quantile function and runif generates random deviates.
Dieter
More information about the R-help
mailing list