/**************************************************************** ***************************************************************** _/ _/ _/_/_/ _/ Numerical Simulation Laboratory _/_/ _/ _/ _/ Physics Department _/ _/_/ _/ _/ Universita' degli Studi di Milano _/ _/ _/ _/ Prof. D.E. Galli _/ _/ _/_/_/ _/_/_/_/ email: Davide.Galli@unimi.it ***************************************************************** *****************************************************************/ #ifndef __Random__ #define __Random__ #define M_PI 3.14159265358979323846 /* pi */ // State for the RANNYU random numbers generator typedef struct Random Random; struct Random { int m1, m2, m3, m4, l1, l2, l3, l4, n1, n2, n3, n4; }; // Initialize Random from open file pointers bool random_init(Random rnd[static 1], FILE *primes, FILE *input); // Method to set the seed for the RNG void random_set_seed(Random rnd[static 1], int[4], int, int); // Method to save the seed to a bool bool random_save_seed( const Random rnd[static 1], const char filename[static 1]); // Method to generate a random number in the range [0,1) double random_rannyu(Random rnd[static 1]); // Method to generate a random number in the range [min,max) double random_rannyu_range(Random rnd[static 1], double min, double max); // Method to generate a random number with a Gaussian distribution double random_gauss(Random rnd[static 1], double mean, double sigma); // Method to generate a random number with an Exponential distribution double random_exp(Random rnd[static 1], double lambda); // Method to generate a random number with a Cauchy-Lorentz // distribution double random_lorentz(Random rnd[static 1], double mean, double gamma); #endif // __Random__ /**************************************************************** ***************************************************************** _/ _/ _/_/_/ _/ Numerical Simulation Laboratory _/_/ _/ _/ _/ Physics Department _/ _/_/ _/ _/ Universita' degli Studi di Milano _/ _/ _/ _/ Prof. D.E. Galli _/ _/ _/_/_/ _/_/_/_/ email: Davide.Galli@unimi.it ***************************************************************** *****************************************************************/