12345678910111213141516171819 |
- namespace MinMaxAB;
- public static class Extensions
- {
- public static T ChooseRandom<T>(this T[] source) => source[Random.Shared.Next(0, source.Length)];
- public static T[,] Fill<T>(int cols, int rows, T value)
- {
- T[,] array = new T[cols, rows];
- for (int i = 0; i < array.GetLength(0); i++)
- {
- for (int j = 0; j < array.GetLength(1); j++)
- {
- array[i, j] = value;
- }
- }
- return array;
- }
- }
|