예제 #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());
        }