diff options
author | Marcus Huderle <huderlem@gmail.com> | 2018-03-15 06:35:40 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-15 06:35:40 -0700 |
commit | a4988e4a997ae17ff686b8c8b9d62cd9df3c18aa (patch) | |
tree | 8ad23a98fef7efaf4a4ca01d3cf440b39e9009c4 /src/random.c | |
parent | 8ef4e1785212901e77bf10a90138c9f69fcb0d8b (diff) | |
parent | 48eee3aa1efff48045b890796a5e7e795604a679 (diff) |
Merge pull request #574 from camthesaxman/reorganize
remove subdirectories
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..8f82b722f --- /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; +} |