cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
How to select random number
How to select random number
Oct 31, 2008 at 6:41pm UTC
matanuragi
(30)
i have certain inputs how to select a random input from it to process the selected one.
Oct 31, 2008 at 7:18pm UTC
jsmith
(5804)
Use srand( time( 0 ) ) to seed the C runtime random number generator (once, at the beginning of your program) then use rand() to generate a random number between 0 and 2^32-1.
Oct 31, 2008 at 7:19pm UTC
ja23jr
(14)
Here are two links to help point you in the right direction.
hope they help
http://www.cplusplus.com/reference/clibrary/cstdlib/rand.html
http://www.cplusplus.com/reference/clibrary/cstdlib/srand.html
Topic archived. No new replies allowed.