Before anyone hazes me for not checking the FAQ I did and didnt see anything related to the question.
2 quick questions about rand()
is,
rand () % 10 + 1 the same thing as rand() % 11
and can you use hex numbers. ex:
rand () % 2 + 1f
thanks
Printable View
Before anyone hazes me for not checking the FAQ I did and didnt see anything related to the question.
2 quick questions about rand()
is,
rand () % 10 + 1 the same thing as rand() % 11
and can you use hex numbers. ex:
rand () % 2 + 1f
thanks
>rand () % 10 + 1 the same thing as rand() % 11
No, % has a higher precedence than +, so you obtain your random number from 10, then add one to the result. The second simply uses 11 to obtain the random number and the result from that is used as is and not modified.
>and can you use hex numbers.
Yes
-Prelude
Thank you
Anytime
-Prelude