Rand_GetBetween
This commit is contained in:
@@ -341,6 +341,13 @@ unsigned Rand_Get() {
|
||||
return (val);
|
||||
}
|
||||
|
||||
unsigned Rand_GetBetween(int min, int max) {
|
||||
if (min == max) {
|
||||
return max;
|
||||
}
|
||||
return (Rand_Get() % (max - min)) + min;
|
||||
}
|
||||
|
||||
/////////////////////////////
|
||||
// Print
|
||||
//
|
||||
|
||||
@@ -87,9 +87,13 @@ int EndsWith(char *str, char *suffix);
|
||||
// Rand
|
||||
//
|
||||
void Rand_Seed(unsigned seed);
|
||||
|
||||
unsigned Rand_Get();
|
||||
|
||||
#define Rand_GetFloat(x) (((float)(Rand_Get() % 1048576)) / 1048576.0f)
|
||||
|
||||
unsigned Rand_GetBetween(int min, int max);
|
||||
|
||||
/////////////////////////////
|
||||
// Print
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user