I would like to know how you can fill the elements of the matrix using a certain function that generates numbers in a given range. In C ++, this code looks like this:
double func(int, int) { return rand() % 12; } Matrix::Matrix(int row, int col, double (*func)(int, int)) { ... ... for (int i = 0; i < this->row; i++) { for (int j = 0; j < this->col; j++) { this->arr[i * this->col + j] = func(i, j); } } } How to implement similar logic in C #?
Func<int, int,double>, so you need to pass it to the constructor - tym32167