Modulus gives the remainder of the division of one number by another. For example 5%2 = 1. 2 fits into 5 two times (and 2x2=4), this leaves 1 as the remainder.
You can also use this equation:
a % b = a - ((int)(a / b)) * b
casting a/b as in integer basically represents the amount of times b can be fit into a.
5 % 7 = 5 - ((int)(5 / 7))* 7 = 5
Examples of Modulus
12 % 6 = 0
13 % 7 = 6
2 % 3 = 2
5 % 4 = 1
Notice that with the form a % b = c. c is always between 0 and b-1. That is to say 0 <= c < b.
This is a good way to constrain certain numbers to a range you might want or bin repeatable types of information.
Some good uses may be:
seconds or minutes are always between 0 and 60.
There are always only 7 days in a week.