Improved randomSelect method.