Created
February 10, 2020 06:11
-
-
Save taoyuan/cfab28e47698c13df75eaa522ae2263c to your computer and use it in GitHub Desktop.
A linear congruential random generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static uint32_t seed = 0; | |
static void srand32(uint32_t s) { | |
seed = s; | |
} | |
static uint32_t rand32(void) { | |
seed = (uint32_t)(((uint64_t)1664525 * seed) + 1013904223); | |
return seed; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment