I am asked to create a unique (no two numbers are the same) set of random numbers (the user inputs the row and column dimensions 'd1' and 'd2')
I am totally lost as to how to compare each element of both arrays to see if they're duplicates.
(Max is the largest value to be generated)
void RandomArray(IntArrayPtr* m, int d1, int d2, int max)
{
for (int i = 0; i < d1; i++)
{
for (int j = 0; j < d2; j++)
{
m[i][j] = (rand() % max + 1);
if (i > 0 && j > 0)
{
if (m[i][j] == m[i][j - 1] || m[i][j] == m[i-1][j])
{
m[i][j] = (rand() % max+ 1);
}
}
}
}
}