You're also calling rand_range too many times. You should only call it once.