another function for the random generator