// program to calculate random numbers #include #include #include using namespace std; int main (int argc, char **argv) { if(argc != 5) { printf("Need 4 arguments: a, b, c and n\n"); exit(0); } unsigned long irand = 1; unsigned long a=atol(argv[1]); unsigned long b=atol(argv[2]); unsigned long c=atol(argv[3]); int n=atoi(argv[4]); // number of steps int i;//the loop counter for(i =0; i< n; i++) //make n steps { cout << i << " "<< irand << " " << ((double)irand)/((double)b) << endl; irand = (a*irand+c)%b; } }