Added a randomInRange function