dbf-halloween2015
diff src/rng.h @ 0:50683c78264e
initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 01 Nov 2015 00:09:12 +0200 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/rng.h Sun Nov 01 00:09:12 2015 +0200 1.3 @@ -0,0 +1,30 @@ 1.4 +#ifndef RNG_H_ 1.5 +#define RNG_H_ 1.6 + 1.7 +#include <stdint.h> 1.8 + 1.9 +struct RandGenState; 1.10 + 1.11 +class RandGen { 1.12 +private: 1.13 + RandGenState *state; 1.14 + 1.15 + RandGen(const RandGen&); 1.16 + RandGen &operator =(const RandGen&); 1.17 + 1.18 +public: 1.19 + RandGen(); 1.20 + ~RandGen(); 1.21 + 1.22 + void seed(uint32_t s); 1.23 + 1.24 + uint32_t generate(); 1.25 + float generate_float(); 1.26 +}; 1.27 + 1.28 +void rng_srand(uint32_t s); 1.29 +uint32_t rng_rand(); 1.30 +float rng_frand(); 1.31 + 1.32 + 1.33 +#endif // RNG_H_