Skip to content

Commit 762befb

Browse files
committed
Corrected function bug
1 parent 62f8f28 commit 762befb

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/core.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,14 @@ int GetHexValue(Color color)
344344
// Returns a random value between min and max (both included)
345345
int GetRandomValue(int min, int max)
346346
{
347-
return (rand()%(abs(max-min)+1) - abs(min));
347+
if (min > max)
348+
{
349+
int tmp = max;
350+
max = min;
351+
min = tmp;
352+
}
353+
354+
return (rand()%(abs(max-min)+1) + min);
348355
}
349356

350357
//----------------------------------------------------------------------------------

0 commit comments

Comments
 (0)