diff options
author | ProjectRevoTPP <projectrevotpp@hotmail.com> | 2018-10-06 16:45:53 -0400 |
---|---|---|
committer | ProjectRevoTPP <projectrevotpp@hotmail.com> | 2018-10-06 16:45:53 -0400 |
commit | eb03b1ab0f00d97126caaade3c7988a973c3a2bb (patch) | |
tree | a8f40974818dadf9ce70a5914d818f54fde27100 /src | |
parent | 9236084ad807cc1d2062d87217beb82a874119ec (diff) | |
parent | 281507d72ea0bc03189469d7d97d4f28979b1cf9 (diff) |
Merge branch 'master' of https://github.com/pret/pokefirered into text
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; +} |