Skip to content
Snippets Groups Projects
Commit 218de550 authored by deuce's avatar deuce
Browse files

For values of less than 2, always return zero. Prevents errors when doing

mod zero for example.
parent 996a120e
No related branches found
No related tags found
No related merge requests found
...@@ -275,9 +275,11 @@ unsigned DLLCALL xp_randomize(void) ...@@ -275,9 +275,11 @@ unsigned DLLCALL xp_randomize(void)
int DLLCALL xp_random(int n) int DLLCALL xp_random(int n)
{ {
#ifdef HAS_RANDOM_FUNC #ifdef HAS_RANDOM_FUNC
if(n<2)
return(0);
return(random()%n); return(random()%n);
#else #else
float f; float f=0;
if(n<2) if(n<2)
return(0); return(0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment