Esempio n. 1
0
        public static T[,] ShuffleArray <T>(this T[,] array)
        {
            int x = array.GetLength(0);
            int y = array.GetLength(1);

            var result = (T[, ])array.Clone();

            for (int j = 0; j < (x + y) / 3; j++)
            {
                var switch0 = new Tuple <int, int>(NewValue.Int(x), NewValue.Int(x));
                var switch1 = new Tuple <int, int>(NewValue.Int(y), NewValue.Int(y));

                for (int i = 0; i < x; i++)
                {
                    var temp = result[i, switch0.Item1];
                    result[i, switch0.Item1] = result[i, switch0.Item2];
                    result[i, switch0.Item2] = temp;
                }

                for (int i = 0; i < y; i++)
                {
                    var temp = result[switch1.Item1, i];
                    result[switch1.Item1, i] = result[switch1.Item2, i];
                    result[switch1.Item2, i] = temp;
                }
            }

            return(result);
        }
Esempio n. 2
0
        public new static ExtendedPerson FillBlanks(Gender PersonGender)
        {
            ExtendedPerson p = (ExtendedPerson)Person.FillBlanks(PersonGender);

            p.PersonGender       = PersonGender;
            p.DateOfBirth        = NewValue.NewDateTime(new DateTime(1970, 1, 1), new DateTime(DateTime.UtcNow.Subtract(new DateTime(15, 1, 1)).Ticks));
            p.RelationshipStatus = (RelationshipStatus)NewValue.Int(4);

            switch (NewValue.Int(3))
            {
            case 0:
                p.School = "Школа";
                break;

            case 1:
                p.School = "Лицей";
                break;

            case 2:
                p.School = "Гимназия";
                break;
            }
            p.School += " №" + NewValue.Int(38, 159);

            switch (NewValue.Int(6))
            {
            case 0:
                p.University = "НИУ ВШЭ";
                break;

            case 1:
                p.University = "СПБГУ";
                break;

            case 2:
                p.University = "МГУ";
                break;

            case 3:
                p.University = "ИТМО";
                break;

            case 4:
                p.University = "МГИМО";
                break;

            case 5:
                p.University = "МФТИ";
                break;
            }
            return(p);
        }
Esempio n. 3
0
        private static int[,] GenerateBasicGraph(int x, int y, int initialValuesLessThan)
        {
            var graph = new int[x, y];

            for (var i0 = 0; i0 < x; i0++)
            {
                for (var i1 = 0; i1 < y; i1++)
                {
                    if (i0 != i1)
                    {
                        graph[i0, i1] = NewValue.Int(1, initialValuesLessThan);
                    }
                }
            }

            return(graph);
        }
Esempio n. 4
0
        public static int IncreaseColumns(this int[,] array, int increaseMin, int increaseMax)
        {
            int x      = array.GetLength(0);
            int y      = array.GetLength(1);
            int result = 0;

            for (var i0 = 0; i0 < x; i0++)
            {
                var num1 = NewValue.Int(increaseMin, increaseMax);
                result += num1;
                for (var i1 = 0; i1 < y; i1++)
                {
                    array[i0, i1] += num1;
                }
            }

            return(result);
        }
Esempio n. 5
0
        public static Person FillBlanks(Gender PersonGender)
        {
            var p = new Person();

            switch (PersonGender)
            {
            case Gender.Male:
            {
                p.First = MaleFirstNames[NewValue.Int(MaleFirstNames.Count)];
                p.Last  = MaleLastNames[NewValue.Int(MaleLastNames.Count)];
                break;
            }

            case Gender.Female:
            {
                p.First = FemaleFirstNames[NewValue.Int(FemaleFirstNames.Count)];
                p.Last  = FemaleLastNames[NewValue.Int(FemaleLastNames.Count)];
                break;
            }
            }

            return(p);
        }
Esempio n. 6
0
 public static Person FillBlanks() => FillBlanks((Gender)NewValue.Int(2));
Esempio n. 7
0
 public new static ExtendedPerson FillBlanks() => FillBlanks((Gender)NewValue.Int(2));