3 * http://www.bagley.org/~doug/shootout/
15 gen_random(double max) {
16 static long last = 42;
17 return( max * (last = (last * IA + IC) % IM) / IM );
21 heapsort(int n, double *ra) {
42 if (j < ir && ra[j] < ra[j+1]) {
57 main(int argc, char *argv[]) {
58 int N = ((argc == 2) ? atoi(argv[1]) : 10);
62 /* create an array of N random doubles */
63 ary = (double *)malloc((N+1) * sizeof(double));
64 for (i=1; i<=N; i++) {
65 ary[i] = gen_random(1);
70 printf("%f\n", ary[N]);