diff options
author | ProjectRevoTPP <projectrevotpp@hotmail.com> | 2017-11-26 16:19:44 -0500 |
---|---|---|
committer | ProjectRevoTPP <projectrevotpp@hotmail.com> | 2017-11-26 16:19:44 -0500 |
commit | cf84c5406bf9b08950722d90ba4eba3bd8606080 (patch) | |
tree | 0140b0b3cb4b1b0b523cd39a71fd775d911c65d0 /src/engine/random.c | |
parent | 2d70a16fa09eb545b0e236313be6daaa6d17964a (diff) | |
parent | 4e7e4cf467e6243994d19971d7cbee33c2f7bd25 (diff) |
merge
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; +} |