Implemented RNG for given intervals.