diff options
author | ProjectRevoTPP <projectrevotpp@hotmail.com> | 2017-08-12 01:26:29 -0400 |
---|---|---|
committer | ProjectRevoTPP <projectrevotpp@hotmail.com> | 2017-08-12 01:26:29 -0400 |
commit | 1a8fe435e7deabf06029c8e50201136518e3af73 (patch) | |
tree | 9746f2f4f4901e81496465da485d0f5c8a647586 /src/engine/rng.c | |
parent | bb0cad7c072703f5a540e8c22c8e137267331f4d (diff) |
split out src/ directory into categorized subdirectories.
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; +} |