summaryrefslogtreecommitdiff
path: root/experimental/tectonics/util.c
blob: aa528fb33180c82ac4607f8f0afa2c23a34a366d (plain)
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);
}