improved random generator