added get within certain range to rand.c