Changed random function to built in code.