float compute_pi( long int seed, uint64_t rounds ) { uint64_t i; uint64_t in = 0; float x, y; unsigned long int h; srand48( seed ); for ( i = 0; i < rounds; i++ ) { x = (float) lrand48()/RAND_MAX; y = (float) lrand48()/RAND_MAX; if (( x * x + y * y ) < 1.0 ) { in++; } } return ( float ) 4.0 * in / rounds; }