RE: Re[2]: [Dev-C++] how to use "srand"
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Dave M. <Dav...@im...> - 2003-03-20 13:46:58
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; = charset=3Diso-8859-1"> <META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version = 5.5.2653.12"> <TITLE>RE: Re[2]: [Dev-C++] how to use "srand"</TITLE> </HEAD> <BODY> <P><FONT SIZE=3D2>> The problem with the normal rand() is that the = low bits of it </FONT> <BR><FONT SIZE=3D2>> are not very</FONT> <BR><FONT SIZE=3D2>> rando, so rand()%11 have a tendancy to generate = a very ugly pattern.</FONT> </P> <P><FONT SIZE=3D2>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.</FONT></P> </BODY> </HTML> |