Computer Science Canada Generating a random number in C++ |
| Author: | Miko99 [ Wed May 21, 2003 9:47 am ] |
| Post subject: | Generating a random number in C++ |
How do i generate a random number in c++? |
|
| Author: | Catalyst [ Wed May 21, 2003 2:26 pm ] |
| Post subject: | |
rand() |
|
| Author: | octopi [ Wed May 21, 2003 3:49 pm ] | ||
| Post subject: | |||
This should demonstrate whats going on. srand seeds the random number generator (makes numbers random) % 10 means mod 10. it will make it so rand() %10 will output numbers between 0-9
|
|||