added -r random mode.