[R] Random Integers
Alberto Vieira Ferreira Monteiro
albmont at centroin.com.br
Sun Feb 25 16:52:18 CET 2007
Charles Annis, P.E. wrote:
>
> rpois(n, lambda)
>
> ... will do it. But you should tell us something about how you want your
> numbers to be distributed, since rpois() produces integers having a Poisson
> distribution.
>
<nitpick>
rpois does not generate random _integers_, it generates random
_natural numbers_.
</nitpick>
The question should be more descriptive. "Random" is half of the things
we need to know, the other half is how deterministic you want your integers.
For example, if you want to generate random integers in such a way that
all integers have the same probability, then this can't be done. OTOH, if
you want to simulate random integers that distribute "like integers appear
in Nature", then it's still not precise, but there are serious attempts
to reproduce this behaviour. Check in the wikipedia (www.wikipedia.org)
those distributions: Zip's law, Zeta distribution, Benford's law,
Zipf-Mandelbrot law. The problem is that all of them generate positive
random integers, but it's not difficult to extrapolate them to integers.
Alberto Monteiro
More information about the R-help
mailing list