RE: Re[2]: [Dev-C++] how to use "srand"
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Per W. <pw...@ia...> - 2003-03-20 15:49:40
|
Yes, modulo with a prime number is better than modula 2^x, but care is still needed. /Per W On Thu, 20 Mar 2003, Dave McMinn wrote: > > > The problem with the normal rand() is that the low bits of it > > are not very > > rando, so rand()%11 have a tendancy to generate a very ugly pattern. > > Isn't that going to be less of a problem when using 11 (or some other non power of 2) with the modulus operator? In those cases, high bits will still have an > effect on the resulting number. > > ------------------------------------------------------- This SF.net email is sponsored by: Tablet PC. Does your code think in ink? You could win a Tablet PC. Get a > free Tablet PC hat just for playing. What are you waiting for? http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en > _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: > http://www.noicys.cjb.net/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |