I need to use rand() on my program but the thing is that it is called on a class and the objects I create need to be in the global scope so I need to call srand() before the main and on the global scope is there a way?
#include <stdlib.h>
#include <iostream>
#include <time.h>
#include "Electron.h"
srand(time(0));
Electron el1;
Electron el2;
Electron el3;
Electron el;
int main(int argc, char** argv){
...
}
Aucun commentaire:
Enregistrer un commentaire