vendredi 2 décembre 2016

C++ rand() function is not working on MPI

I have an interesting situation here.

I've include the libraries #include <stdlib.h> which is suppose to allowed me to use rand()

In the same time I've used 2 different solution, one with std::rand() and one just with rand() in both of this cases I have declared in my top of program using namespace std.

But still I get this error:

Can't resolve variable 'rand'

And here it's my code:

void makeAB() {
    for (i = 0; i < NUM_ROWS_A; i++) {
        for (j = 0; j < NUM_COLUMNS_A; j++) {
            int i = std::rand();
            mat_a[i][j] = rand() % 10;//i + j;
        }
    }
}

Any idea what I'm doing wrong?




Aucun commentaire:

Enregistrer un commentaire