made the random work properly