more efficient random generator