Improvement to the select_at_random method.