Implement the random() function