home projects git about
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include <math.h> #include <stdlib.h> #include "util.h" double rand01() { return ((double) rand())/RAND_MAX; } double distance(struct point_t p1, struct point_t p2) { double dx = p1.x-p2.x; double dy = p1.y-p2.y; return sqrt(dx*dx + dy*dy); }