Doxygen Source Code Documentation
randgen.c File Reference
Go to the source code of this file.
Functions | |
void | rand_initialize (long int seedval) |
float | rand_uniform (float a, float b) |
float | rand_normal (float mu, float var) |
void | rand_binormal (float mu, float var, float *n1, float *n2) |
Function Documentation
|
Definition at line 75 of file randgen.c. References n1, n2, r, rand_uniform(), and var.
00076 { 00077 float u1, u2; 00078 float r, sigma; 00079 00080 00081 u1 = 0.0; 00082 while (u1 <= 0.0) 00083 { 00084 u1 = rand_uniform (0.0, 1.0); 00085 } 00086 u2 = rand_uniform (0.0, 1.0); 00087 00088 r = sqrt(-2.0*log(u1)); 00089 sigma = sqrt (var); 00090 00091 *n1 = mu + r * cos(2.0*PI*u2) * sigma; 00092 *n2 = mu + r * sin(2.0*PI*u2) * sigma; 00093 } |
|
Definition at line 28 of file randgen.c. Referenced by initialize_program().
00029 { 00030 srand48 (seedval); 00031 } |
|
Definition at line 50 of file randgen.c. References r, rand_uniform(), and var. Referenced by calc_response().
00051 { 00052 float u1, u2; 00053 float r, n; 00054 00055 00056 u1 = 0.0; 00057 while (u1 <= 0.0) 00058 { 00059 u1 = rand_uniform (0.0, 1.0); 00060 } 00061 u2 = rand_uniform (0.0, 1.0); 00062 00063 r = sqrt(-2.0*log(u1)); 00064 n = r * cos(2.0*PI*u2); 00065 00066 return (mu + n * sqrt(var)); 00067 } |
|
Definition at line 39 of file randgen.c. References a. Referenced by markov_array(), permute_array(), poly_field(), rand_binormal(), rand_normal(), resample(), restart(), segment_x_slices(), segment_y_slices(), segment_z_slices(), shuffle_array(), and simplex_initialize().
|