Corrected function bug

This commit is contained in:
raysan5 2014-01-07 16:53:57 +01:00
parent 62f8f284b9
commit 762befb967

View File

@ -344,7 +344,14 @@ int GetHexValue(Color color)
// Returns a random value between min and max (both included)
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);
}
//----------------------------------------------------------------------------------