diff options
author | paul <nintendo6496@googlemail.com> | 2018-10-07 00:16:29 +0200 |
---|---|---|
committer | paul <nintendo6496@googlemail.com> | 2018-10-07 00:16:29 +0200 |
commit | 0a51caf56bba9d0e75addae0c4749fb7590ab60c (patch) | |
tree | 031cce81efb61629cf9b1bc78fac9672ffb893fc /src/random.c | |
parent | 1ee1ebe23a49bbbc040a43e0e6fb81badc588f22 (diff) | |
parent | 281507d72ea0bc03189469d7d97d4f28979b1cf9 (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/random.c')
-rw-r--r-- | src/random.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/random.c b/src/random.c new file mode 100644 index 000000000..54dae0824 --- /dev/null +++ b/src/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; +} |