+
+static double random_gauss (double mu, double sd);
+
+/* Generate a random cancellation position, but skew it towards
+ * smaller numbers.
+ */
+static off_t
+random_cancel_posn (void)
+{
+ const double mu = 65536;
+ const double sd = 65536 * 4;
+ double r;
+
+ do {
+ r = random_gauss (mu, sd);
+ } while (r <= 0);
+
+ return (off_t) r;
+}
+
+/* Generate a random Gaussian distributed number using the Box-Muller
+ * transformation. (http://www.taygeta.com/random/gaussian.html)
+ */
+static double
+random_gauss (double mu, double sd)
+{
+ double x1, x2, w, y1;
+
+ do {
+ x1 = 2. * drand48 () - 1.;
+ x2 = 2. * drand48 () - 1.;
+ w = x1 * x1 + x2 * x2;
+ } while (w >= 1.);
+
+ w = sqrt ((-2. * log (w)) / w);
+ y1 = x1 * w;
+ //y2 = x2 * w;
+ return mu + y1 * sd;
+}