Made the use of random object more efficent.