Generate better random numbers.

Attempt to make the random numbers more evenly distributed by ensuring
we cap the generated number (before we mod over the range) at a
multiple of the range.

Previously, we accepted any number up to 255, and the lower numbers
from the range would have been slightly more common than the higher
numbers.

Signed-off-by: Russell Steicke <russells@adelie.cx>