Corrected function bug
This commit is contained in:
parent
62f8f284b9
commit
762befb967
@ -344,7 +344,14 @@ int GetHexValue(Color color)
|
|||||||
// Returns a random value between min and max (both included)
|
// Returns a random value between min and max (both included)
|
||||||
int GetRandomValue(int min, int max)
|
int GetRandomValue(int min, int max)
|
||||||
{
|
{
|
||||||
return (rand()%(abs(max-min)+1) - abs(min));
|
if (min > max)
|
||||||
|
{
|
||||||
|
int tmp = max;
|
||||||
|
max = min;
|
||||||
|
min = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (rand()%(abs(max-min)+1) + min);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user