Example #1
0
        /// <summary>
        /// Returns a random item from the list.
        /// </summary>
        public T RandomItem <T>(IList <T> list)
        {
            int randomIndex = Int.FromRange(0, list.Count);

            return(list[randomIndex]);
        }
Example #2
0
 /// <summary>
 /// Returns +1 or -1 randomly.
 /// </summary>
 public int RandomSign()
 {
     return(Int.FromRange(0, 2) * 2 - 1); //0*2 -1 = -1 | 1*2 -1 = 1
 }