// RandDemo9.cc #include using namespace std; int main() { double x, y ; int r, s ; int seed=123 ; srandom(seed); // Initialise random number generator r = random() ; // random number between 0 and (2**31-1) x = ((double)r/(1.0+(double)RAND_MAX)) ; s = random() ; y = ((double)s/(1.0+(double)RAND_MAX)); cout << r << " " << s << endl; cout << x << " " << y << endl; if ( x*x + y*y < 1.0 ) { cout << "outcome: in" << endl ; } else { cout << "outcome: out" << endl ; } return 0; }