Created
November 2, 2017 16:59
-
-
Save gabeio/c850edd0c35c033f4632bfba00fab3e9 to your computer and use it in GitHub Desktop.
Generic Random Select
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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