Skip to content

Instantly share code, notes, and snippets.

@gabeio
Created November 2, 2017 16:59
Show Gist options
  • Save gabeio/c850edd0c35c033f4632bfba00fab3e9 to your computer and use it in GitHub Desktop.
Save gabeio/c850edd0c35c033f4632bfba00fab3e9 to your computer and use it in GitHub Desktop.
Generic Random Select
class RandomSelect<T>
{
private Random r;
public RandomSelect()
{
this.r = new Random();
}
public T Select(List<T> arr)
{
return arr[this.r.Next(arr.Count)];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment