| ??? 12/29/03 22:41 Read: times |
#61530 - RE: Random number from 1 to 8 Responding to: ???'s previous message |
100 is not quite enough to give a definite answer, laws of big numbers don't kick in. Like, I don't know if just 5 "ones" is a "bad luck" or a rule. Just as well as rising/falling patterns and quite frequent "3 in a row".
If I was to give opinion on that sample only, I'd say "It's bad." But as I said, it may be just "bad luck" with random numbers. BTW, I don't know about your uC, but on ADuC812 if I wanted good level of entropy, I'd just read lowest bits from ADC attached to on-chip temp sensor in 12bit mode and shortest possible sample time (noisy readout) :) I'm not sure what code is there behind rand() but if it's the same code Linux manpage talks about... However, on older rand() implementa- tions, the lower-order bits are much less random than the higher-order bits. 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)." then... it's bad... |



