Implement random mode.