diff options
author | camthesaxman <cameronghall@cox.net> | 2017-11-26 02:24:41 -0600 |
---|---|---|
committer | camthesaxman <cameronghall@cox.net> | 2017-11-26 02:24:41 -0600 |
commit | 48c6d764e00285378d3f24d954855c6bde613bc0 (patch) | |
tree | 82f907925cb280cfeccfc0eeb66595e87cea6f5b /src/engine/random.c | |
parent | 4e1098beb6a84a46f0ac2bff37013a3f675f6750 (diff) | |
parent | d373f41c2cbd2dc71ca2287b179c7c8777b9eb02 (diff) |
fix merge conflicts
Diffstat (limited to 'src/engine/random.c')
-rw-r--r-- | src/engine/random.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/engine/random.c b/src/engine/random.c new file mode 100644 index 000000000..8f82b722f --- /dev/null +++ b/src/engine/random.c @@ -0,0 +1,18 @@ +#include "global.h" +#include "random.h" + +// The number 1103515245 comes from the example implementation of rand and srand +// in the ISO C standard. + +u32 gRngValue; + +u16 Random(void) +{ + gRngValue = 1103515245 * gRngValue + 24691; + return gRngValue >> 16; +} + +void SeedRng(u16 seed) +{ + gRngValue = seed; +} |