made the random generator internal