Exemple #1
0
        public Vector2 GetRandomPoint()
        {
            float magnitude = PRandom.Range(InnerRadius, OuterRadius);
            var   direction = Vector2.right.Rotate(PRandom.Range(0f, 360f));

            return(direction * magnitude + Position);
        }
Exemple #2
0
        public static T GetRandom <T>(this IList <T> array)
        {
            if (array == null || array.Count == 0)
            {
                return(default(T));
            }

            return(array[PRandom.Range(0, array.Count - 1)]);
        }
Exemple #3
0
 public float GetRandom(ProbabilityDistributions distribution = ProbabilityDistributions.Uniform)
 {
     return(PRandom.Range(min, max, distribution));
 }
Exemple #4
0
 public static T PopRandom <T>(this T[] array, out T[] remaining)
 {
     return(array.Pop(PRandom.Range(0, array.Length - 1), out remaining));
 }