| 35 | #define LEN 10000000 |
| 36 | |
| 37 | int main (void) |
| 38 | { |
| 39 | double *x ; |
| 40 | int i ; |
| 41 | |
| 42 | fprintf (stderr, "simple_demo:\n") ; |
| 43 | double n = ((double) LEN) / 1e6 ; |
| 44 | |
| 45 | // calloc the space for more accurate timing |
| 46 | x = (double *) calloc (LEN, sizeof (double)) ; |
| 47 | if (x == NULL) |
| 48 | { |
| 49 | fprintf (stderr, "simple_demo: out of memory\n") ; |
| 50 | exit (1) ; |
| 51 | } |
| 52 | |
| 53 | // generate random numbers |
| 54 | for (i = 0 ; i < LEN ; i++) |
| 55 | { |
| 56 | x [i] = simple_rand_x ( ) ; |
| 57 | } |
| 58 | |
| 59 | // these should be the same on any system and any compiler |
| 60 | printf ("first 10 random numbers:\n") ; |
| 61 | for (i = 0 ; i < 10 ; i++) |
| 62 | { |
| 63 | printf ("%12.6f\n", x [i]) ; |
| 64 | } |
| 65 | |
| 66 | // generate random uint64_t numbers |
| 67 | double t1 ; |
| 68 | |
| 69 | for (i = 0 ; i < LEN ; i++) |
| 70 | { |
| 71 | simple_rand_i ( ) ; |
| 72 | } |
| 73 | |
| 74 | free (x) ; |
| 75 | } |
| 76 |
nothing calls this directly
no test coverage detected