Explorar o código

Fixed Math.random().

Steven Hall %!s(int64=8) %!d(string=hai) anos
pai
achega
c8fbdb096e
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/optionals/gravity_math.c

+ 1 - 1
src/optionals/gravity_math.c

@@ -517,7 +517,7 @@ static bool math_random (gravity_vm *vm, gravity_value_t *args, uint16_t nargs,
     }
     }
     
     
     int r = rand();
     int r = rand();
-    RETURN_VALUE(VALUE_FROM_FLOAT(r / RAND_MAX), rindex);
+    RETURN_VALUE(VALUE_FROM_FLOAT((float)r / RAND_MAX), rindex);
 }
 }
 
 
 // rounds x to the nearest integer
 // rounds x to the nearest integer