random number library in C
1. uniform random number
download head file ran_uniform.h and C source code ran_uniform.c
in your main source code, main.c, add the head file
#include "ran_uniform.h"
#include <time.h> // in order to use function time()
initialize random seed
by system time
InitializeRandomNumberGenerator(time(0l)); // it is 0L, not 0 one
or by randomseed, where randomseed is a number from input
InitializeRandomNumberGenerator(randomseed);
to generate a uniform random number x between 0~1
x=RandomNumber();
2. Box-Muller Gaussian random number
You need to have uniform random number generator work first as discussed above.
download C source code boxmuller.c
to generate a Gaussian random number x with mean m and standard deviation s
x=BoxMuller(m,s);