[Prévia cron] [Próxima Cron] [Prévia por assunto] [Próxima por assunto]
[Índice cronológico]
[Índice de assunto]
[Índice de autor]
Random Numbers
- Subject: Random Numbers
- From: "Vito A. Di Leo G." <vidileo@attglobal.net>
- Date: Wed, 22 Nov 2000 12:36:43 -0200
In Numerical Recipes in C: The Art of Scientific Computing (William H.
Press, Brian P. Flannery, Saul A. Teukolsky, William T. Vetterling; New
York: Cambridge University Press, 1990 (1st ed, p. 207)), the following
comments are made:
"If you want to generate a random integer between 1 and 10,
you should always do it by
j=1+(int) (10.0*rand()/(RAND_MAX+1.0));
and never by anything resembling
j=1+((int) (1000000.0*rand()) % 10);
(which uses lower-order bits)."
Isto veio do manual do linux sobre "rand". O q q isto quer dizer? Qual é o
porque? Por favor não me mandem ler aquele livro que to sem tempo!
obrigado,
Vito