diff options
author | camthesaxman <cameronghall@cox.net> | 2017-11-08 17:25:26 -0600 |
---|---|---|
committer | camthesaxman <cameronghall@cox.net> | 2017-11-08 17:25:26 -0600 |
commit | fc11078cef11edc9deedd08c6175fb5e6628504c (patch) | |
tree | 62823b5dc1335a4d8659104dc4156713674ce757 /src/engine/rng.c | |
parent | ba06c424c974f18f9c4af85eb0ffe8adc6056941 (diff) | |
parent | 8832b766facd48c85c1b99ac6dad555f1e2aa1c7 (diff) |
fix merge conflicts
Diffstat (limited to 'src/engine/rng.c')
-rw-r--r-- | src/engine/rng.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/engine/rng.c b/src/engine/rng.c new file mode 100644 index 000000000..7d4b5600e --- /dev/null +++ b/src/engine/rng.c @@ -0,0 +1,18 @@ +#include "global.h" +#include "rng.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; +} |