fix random generator