// Test of closest pair algorithms // David Eppstein, UC Irvine, 19 Apr 1997 // // Generate table of random distances #include "RandDist.h" #include "Random.h" RandomDistance::RandomDistance(unsigned long np) : PointSet(np) { seed = RandomLong(); } double RandomDistance::operator() (point i, point j) { gDistances++; if (i > j) { // switch order to make distance symmetric point k = i; i = j; j = k; } SeedRandom(seed ^ i); // seed randomization w/point indices SeedRandom(RandomLong() ^ j); return RandomDouble(); }