|
From: Dave M. <Dav...@im...> - 2003-03-20 08:39:16
|
<!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: [Dev-C++] how to use "srand"</TITLE> </HEAD> <BODY> <P><FONT SIZE=3D2>> how to use srand() function. how to define the = seed for this.</FONT> <BR><FONT SIZE=3D2>> suppose i want to generate a random number = between 0 and 10. </FONT> <BR><FONT SIZE=3D2>> then what seed should i use...</FONT> </P> <P><FONT SIZE=3D2>The seed just determines in what order the random = numbers are produced, not what the numbers are. If you want to generate = a random number between 0 and 10, then you could do it like = this:</FONT></P> <P><FONT SIZE=3D2>number =3D rand() % 11;</FONT> </P> </BODY> </HTML> |