| 25 |
|
* from his, the first two interfaces and the style of some comments are very |
| 26 |
|
* much derived from his work. */ |
| 27 |
|
|
| 28 |
< |
|
| 28 |
> |
#include <stdlib.h> |
| 29 |
|
#include "hilbert.h" |
| 30 |
|
|
| 31 |
|
/* implementation of the hilbert functions */ |
| 1256 |
|
printf("How many points? "); |
| 1257 |
|
scanf("%d", &n); |
| 1258 |
|
a = (double*) malloc(2*n*sizeof(double)); |
| 1259 |
< |
for (i = 0; i < n; ++i) |
| 1260 |
< |
a[2*i] = drand48()-0.5, a[2*i+1] = drand48()-0.5; |
| 1261 |
< |
|
| 1259 |
> |
for (i = 0; i < n; ++i) { |
| 1260 |
> |
a[2*i] = rand()*(1./RAND_MAX) - 0.5; |
| 1261 |
> |
a[2*i+1] = rand()*(1./RAND_MAX) - 0.5; |
| 1262 |
> |
} |
| 1263 |
|
qsort(a, n, 2*sizeof(double), cmp); |
| 1264 |
|
|
| 1265 |
|
for (i = 0; i < n; ++i) |