Random matrix
From ATI public wiki
Revision as of 08:57, 16 December 2014 by Hkinks (Talk) (Created page with "==Maatriksi genereerimine random funktsiooniga== <source lang="c" collapse="false" first-line="2"> #include <stdio.h> #include <time.h> #define MAX 15 void generateMatrix(in...")
Maatriksi genereerimine random funktsiooniga
#include <stdio.h>
#include <time.h>
#define MAX 15
void generateMatrix(int M[MAX][MAX], int n, int m) {
int i, j;
srand(time(NULL));
for (i = 0; i < n; i++) {
for (j = 0; j < m; j++) {
M[i][j] = rand()%50;
}
}
}