diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2017-12-23 12:57:46 -0500 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2017-12-23 12:57:46 -0500 |
commit | fdd7e7cb848747a1e0ace8a63d29aaa22dfd1140 (patch) | |
tree | 6ddaed4de52bfcc517d573a8f30c5bd0a1650782 /src/engine/random.c | |
parent | bb8f652504f886af296ffcaac57bf76cdc893c97 (diff) | |
parent | 1c1ce902515ccb3ccecde29611711c9b1a3ce955 (diff) |
Merge branch 'master' into cable_car
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; +} |