Evo sta kaze man rand-a:
Citat:
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, 1992 (2nd ed., p. 277)), the following comments are made:
"If you want to generate a random integer between 1 and 10, you should always do it by using high-order bits, as in
j = 1 + (int) (10.0 * (rand() / (RAND_MAX + 1.0)));
and never by anything resembling
j = 1 + (rand() % 10);
(which uses lower-order bits)."
I da, rand je cudna funkcija, zove se rand, ali to je u stvari samo pseudo-random generator, koji koristi razne variable iz tvog sistema da bi ti dao jedan lep random broj.
Ako ti nije dovoljno "random", pokusaj sta si rekao, stavi puno deljenja i mnozenja, pa mi reci kad si uspeo da napravis neku random funkciju. Cela jedna grana matematike se bavi time, a ti hoces da sklopis nesto nabrzaka...
[Ovu poruku je menjao rumpl dana 23.02.2006. u 11:04 GMT+1]
"The problem with the world is that everyone is a few drinks behind."
-Humphrey Bogart