Added function SetRandomSeedWithTime
This function seeds the random number generator using the time since epoch, allowing for a unique seed from within the library.
This commit is contained in:
parent
0f4a8cf7cb
commit
e3560ee732
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user