Sample: cleaning up Inheritance
[io/quag.git] / libs / basekit / source / RandomGen.h
blob231b3454012970583ab99c2fffeb1f1faa7849c8
3 #ifndef RANDOMGEN_DEFINED
4 #define RANDOMGEN_DEFINED 1
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
10 #include "Common.h"
12 #define RANDOMGEN_N 624
14 typedef struct
16 unsigned long mt[RANDOMGEN_N]; // the array for the state vector
17 int mti; // mti==N+1 means mt[N] is not initialized
18 double y2; // guassian
19 int use_last; // guassian
20 } RandomGen;
22 BASEKIT_API RandomGen *RandomGen_new(void);
23 BASEKIT_API void RandomGen_free(RandomGen *self);
25 BASEKIT_API void RandomGen_setSeed(RandomGen *self, unsigned long seed);
26 BASEKIT_API void RandomGen_chooseRandomSeed(RandomGen *self);
28 // generates a random number on between 0.0 and 1.0
29 BASEKIT_API double RandomGen_randomDouble(RandomGen *self);
31 BASEKIT_API int RandomGen_randomInt(RandomGen *self);
33 BASEKIT_API double RandomGen_gaussian(RandomGen *self, double mean, double standardDeviation);
35 #ifdef __cplusplus
37 #endif
38 #endif