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
Generating Random Numbers..
Generating Random Numbers..
Oct 29, 2015 at 4:01am UTC
shamieh
(161)
I'm confused, I was under the impression that:
rand() % (16+1)
would generate random numbers between 1 to 16, yet for some reason it is generating 0's too. How could that be?
Oct 29, 2015 at 4:04am UTC
shamieh
(161)
Ahh, scratch that. Apparently you can't put the numbers in parenthesis. Ha, who would of knew lol. Guess it was thinking I was saying
rand() % 17
which would of made sense of why it was generating numbers from
0 to 17
.
Topic archived. No new replies allowed.