public static T ChooseAndExtract <T>(this IRNG random, IList <T> list) { var index = random.ChooseIndex(list); var item = list[index]; list.RemoveAt(index); return(item); }
public static T Choose <T>(this IRNG random, IReadOnlyList <T> list) { var index = random.ChooseIndex(list); return(list[index]); }
public static T Choose <T>(this IRNG random, IReadOnlyCollection <T> items) { var index = random.ChooseIndex(items); return(items.ElementAt(index)); }