2015-12-22 02:48:00 +08:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Burtle Prng - Modified. 42iterations instead of 20.
|
|
|
|
// ref: http://burtleburtle.net/bob/rand/smallprng.html
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#ifndef __PRNG_H
|
|
|
|
#define __PRNG_H
|
2019-08-08 22:57:33 +08:00
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
|
2019-03-09 15:59:13 +08:00
|
|
|
typedef struct prng_ctx {
|
2019-03-10 02:19:50 +08:00
|
|
|
uint32_t a;
|
|
|
|
uint32_t b;
|
|
|
|
uint32_t c;
|
|
|
|
uint32_t d;
|
2015-12-22 02:48:00 +08:00
|
|
|
} prng_ctx;
|
|
|
|
|
|
|
|
//uint32_t burtle_get( prng_ctx *x );
|
2019-03-10 07:00:59 +08:00
|
|
|
uint32_t burtle_get_mod(prng_ctx *x);
|
|
|
|
void burtle_init_mod(prng_ctx *x, uint32_t seed);
|
|
|
|
void burtle_init(prng_ctx *x, uint32_t seed);
|
2015-12-22 02:48:00 +08:00
|
|
|
|
2019-03-10 07:00:59 +08:00
|
|
|
uint32_t GetSimplePrng(uint32_t seed);
|
2019-08-08 22:57:33 +08:00
|
|
|
|
2019-03-12 07:12:26 +08:00
|
|
|
#endif /* __PRNG_H */
|