Fixed issue with random genarator not working correctly.