/* FILE: randBoard.cpp last change: 27-Feb-2014 author: Romeo Rizzi * randomly generates a random 5x5 0/1-matrix . * Usage syntax: * > randMatrix seed */ #include #include #include #include using namespace std; const int N = 5; int seed; int RandNumber(int min, int max) { return min + (int) ( (max-min +1) * (double( rand()-0.000000000001 ) / RAND_MAX ) ); } int main(int argc, char** argv) { srand(time(NULL)); if(argc > 1) srand( atoi(argv[1]) ); for(int i = 0; i < N; i++) { for(int j = 0; j < N; j++) cout << RandNumber(0, 1) << " "; cout << endl; } return 0; }