diff options
author | Marcus Huderle <huderlem@gmail.com> | 2018-10-06 12:02:06 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-06 12:02:06 -0500 |
commit | 2e774667c86ea2b003102bc4e3308fbbde246353 (patch) | |
tree | 09df160c08662da1aae9610a1af6d4da5a47ce64 /src | |
parent | 2cb551cf0df29e2602d6a80c16f8bac0a136b134 (diff) | |
parent | 77e95d1309f5da9306c69c7aee23587e0c169ceb (diff) |
Merge pull request #14 from SatoMew/master
decompile random.c
Diffstat (limited to 'src')
-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; +} |