Allow users to provide their own implementation of random.