I feel stupid right now cause I'm copying the exact code my prof posted and it won't work. It say's 'time' is not declared in the scope. Using codeblocks with G++11.
Thanks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <iostream>
#include <cstdlib>
usingnamespace std;
int main() {
srand(time(NULL)); // set random number seed based on current time
for(int i = 0; i < 10; ++i) {
int r = rand();
cout << r << "\n";
}
cout << "RAND_MAX = " << RAND_MAX << "\n";
} // main