예제 #1
0
 public static T GetRandom <T>(this T[] arr, RNG rng)
 {
     return(arr[Mathf.Clamp((int)(rng.Next() * arr.Length), 0, arr.Length)]);
 }
예제 #2
0
 public static T GetRandom <T>(this List <T> list, RNG rng)
 {
     return(list[Mathf.Clamp((int)(rng.Next() * list.Count), 0, list.Count)]);
 }