Random Function

//This program will demonstrate the random function.

#include<stdlib.h>//nessesary for random numbers
#include<iostream.h>//nessesary for cin and cout
#include<time.h>//lets random number change with clock

main()
{
srand((unsigned)time(NULL));//reseeding random number based on the computer's clock
int r1=rand();//retreaving a random number from 0 to RAND_MAX (32767)
cout << RAND_MAX << '\n';
cout << r1 << "***\n";
cout << r1 % 1 << "****" << r1 % 2 << "***\n";
cout << r1 % 3 << "****" << r1 % 4 << "***\n";
cout << r1 % 5 << "****" << r1 % 6 << "***\n";
cout << r1 % 7 << "****" << r1 % 8 << "***\n";
cout << r1 % 9 << "****" << r1 % 10 << "***\n";
cout << r1 % 11 << "****" << r1 % 12 << "end output\n";

return 0;

}
/*
32767
7978***
0****0***
1****2***
3****4***
5****2***
4****8***
3****10end output
*/