Fix random generator