示例#1
0
        static public T RandomForList <T>(List <T> values)
        {
            FisherRandom random = new FisherRandom();
            int          index  = random.GetRandomNumber(values.Count);

            return(values[index]);
        }
示例#2
0
        /// <summary>
        /// 获取数组里面的随机内容
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="array"></param>
        /// <returns></returns>
        static public T RandomForArray <T>(T[] values)
        {
            FisherRandom random = new FisherRandom();
            int          index  = random.GetRandomNumber(values.Length);

            return(values[index]);
        }