graphprogram/graph.c

18 lines
573 B
C
Raw Normal View History

2024-09-26 14:32:20 +02:00
#include <stdint.h>
#include <time.h>
#include <stdlib.h>
void random_adjacency(const uint64_t row_length, const uint64_t column_length, uint64_t matrix[row_length][column_length]) {
srand(time(NULL));
for (uint8_t row_index=0; row_index < row_length; row_index++) {
for (uint8_t column_index=0; column_index < column_length; column_index++) {
if(column_index == row_index) {
matrix[row_index][column_index] = 1;
continue;
}
matrix[row_index][column_index] = rand()%2;
}
}
}