Notes week of Oct 5

Pseudo-random numbers

rand-intro.cpp

#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main()
{
    srand(time(0));
    cout << "RAND_MAX is" << RAND_MAX << endl;
    cout << rand()%6+1 << endl;
    cout << rand()%6+1 << endl;
    cout << rand()%6+1 << endl;
    cout << rand()%6+1 << endl;
    cout << rand()%6+1 << endl;
    return 0;
}