示例#1
0
        public static T Random <T>(this IEnumerable <T> enumerable)
        {
            var list = enumerable.ToList();
            var rand = RandHelper.GetRand();

            return(list[rand.Next(list.Count)]);
        }
示例#2
0
        public static void PlaceBot(Bot bot)
        {
            var rand = RandHelper.GetRand();

            do
            {
                bot.X = rand.Next(bot.grid.ColumnCount);
                bot.Y = rand.Next(bot.grid.RowCount);
            } while (!bot.grid.GetCurrCell(bot).CanStepIn() || bot.grid.GetCurrCell(bot).IsFinal());
        }