Srand Time Null Dev C%2b%2b

  

2003-03-20 00:11:03 UTC
Srand Time Null Dev C%2b%2b

// In File scmain.cpp // For srand declaration. #include // For time #include // In file foodrvr.h // For rand function. #include I would suggest you look into another random number generator such as boost::random, or if you are on Linux System you can also look into /dev/random or /dev/urandom files which are. Question: Remove Srand(time(NULL)); From This C Code So That It Still Finds Random(search Numbers) Numbers Correctly(the Code Works Without It, But The Search Number Is 2 The First Two Times The Program Is Run. It Needs To Be Truly Random). The srand function in C seeds the pseudo-random number generator used by the rand function. The seed for rand function is 1 by default. It means that if no srand is called before rand, the rand function behaves as if it was seeded with srand(1). Note: A 'seed' is the starting point for a sequence of pseudo-random numbers.To learn more, visit this link in StackOverflow.

Time

B X 2b

Hi!
friends...i have got a doubt...
how to use srand() function. how to define the seed for this.
suppose i want to generate a random number between 0 and 10. then what seed should i use...
though rand() function works fine....i just wanted to know the difference beween srand() and rand()...
_____________________________________________________________
Get email for your site ---> http://www.everyone.net
_____________________________________________________________
Select your own custom email address for FREE! Get ***@yourchoice.com w/No Ads, 6MB, POP & more! http://www.everyone.net/selectmail?campaign=tag