#include "fracture.h" unsigned long int rand_seed() { FILE *f = fopen("/dev/urandom", "r"); unsigned long int seed; fread(&seed, sizeof(unsigned long int), 1, f); fclose(f); return seed; } long double rand_dist_pow(const gsl_rng *r, double beta) { long double x = 0; // underflow means that for very small beta x is sometimes identically zero, // which causes problems while (x == 0.0) { long double y = logl(gsl_rng_uniform_pos(r)) / beta; x = expl(y); } return x; }