diff --git a/src/raylib.h b/src/raylib.h index c03e0a576..fbfaabb75 100644 --- a/src/raylib.h +++ b/src/raylib.h @@ -1055,7 +1055,8 @@ RLAPI void WaitTime(double seconds); // Wait for so // Misc. functions RLAPI int GetRandomValue(int min, int max); // Get a random value between min and max (both included) -RLAPI void SetRandomSeed(unsigned int seed); // Set the seed for the random number generator +RLAPI void SetRandomSeed(unsigned int seed); // Set the seed for the random number generator using custom value. +RLAPI void SetRandomSeedWithTime(void); // Set the seed for the random number generator using time since epoch. RLAPI void TakeScreenshot(const char *fileName); // Takes a screenshot of current screen (filename extension defines format) RLAPI void SetConfigFlags(unsigned int flags); // Setup init configuration flags (view FLAGS) RLAPI void OpenURL(const char *url); // Open URL with default system browser (if available) diff --git a/src/rcore.c b/src/rcore.c index 3efa67b2c..54cef3b9a 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -1338,12 +1338,18 @@ int GetRandomValue(int min, int max) return (rand()%(abs(max - min) + 1) + min); } -// Set the seed for the random number generator +// Set the seed for the random number generator using custom value. void SetRandomSeed(unsigned int seed) { srand(seed); } +// Set the seed for the random number generator using time since epoch. +void SetRandomSeedWithTime(void) +{ + srand((unsigned int)time(NULL)); +} + // Takes a screenshot of current screen (saved a .png) void TakeScreenshot(const char *fileName) {