int oldrand = <prior random number>; int adder = randomNumberGenerator() % 4; int newrand = (oldrand + adder + 1) % 5;