Updated random generator and thread sleep.