Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

1
  • 1
    The modulo operator on an integer returns the remainder of the division of lhs by rhs (left hand side and right hand side respectively). rand() returns an unsigned integer between 0 and RAND_MAX, which is at least 32,767. What's the maximum remainder you can have if you're dividing something by two? By three? You could have found this out yourself by searching for "what does rand() return" and "how does modulo work" en.cppreference.com/w/cpp/numeric/random/rand en.cppreference.com/w/cpp/language/operator_arithmetic Commented May 16, 2020 at 4:41