the modulus operator (%) takes the left side, divides it by the right side, and returns the remainder. So, 5%3 would result in two, since 5/3 yields a remainder 2.
If you are getting a division by zero error, that means the value on the right side of the equation is 0. Debug the value of your '$POST_number' variable, your error lies there.
Consider the following for random number generation emulating dice rolls:
srand(time());
$minimum = 1;
$maximum = 20;
$roll = rand($minimum , $maximum);
print "You rolled: $roll";
the above creates a min and max and uses the built-in functionality of rand to return the roll.
$range = range(1,20);
shuffle($range);
print "You rolled: ".$range[0];
the above does the same as the previous, just with less code. the range function creates an array of numbers starting with the first argument, ending with the last. The above example has created an array of twenty elements , values 1-20. The shuffle function takes that array and randomizes the order of its elements. The nice thing about shuffle, is that it seeds the random number generator automatically (srand function). By printing any element of the array after shuffling (I print the first one here), you get a random number within the range.