Implement random function according to data contract.