Implemented random mode.