Nearly Divisionless Random Integer Generation on Various Systems
Naively, you could take the random integer and compute the remainder of the division by the size of the interval. The conventional techniques supported in Java and Go require at least one or two integer division per integer generated. Practically speaking, avoiding integer divisions is a good way to generate faster code.
Source: lemire.me