Maybe factor out the random number generator to an InputRange?