Esempio n. 1
0
        public Task <Matrix> GenerateMatrix(int size)
        {
            if (size == 0 || size < 0)
            {
                throw new Exception("Incorrect size");
            }

            var matrix = new Matrix()
            {
                Rows = new int[size][]
            };

            for (int i = 0; i < size; i++)
            {
                matrix.Rows[i] = new int[size];

                for (int j = 0; j < size; j++)
                {
                    matrix.Rows[i][j] = random.Next(-10, 10);
                }
            }

            return(matrixRepository.Save(matrix));
        }