summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pure')
-rwxr-xr-xlib/pure/math.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/pure/math.nim b/lib/pure/math.nim
index c44d786b1..972b013c3 100755
--- a/lib/pure/math.nim
+++ b/lib/pure/math.nim
@@ -190,7 +190,7 @@ when not defined(ECMAScript):
 else:  
   proc mathrandom(): float {.importc: "Math.random", nodecl.}
   proc floor*(x: float): float {.importc: "Math.floor", nodecl.}
-  proc random*(max: int): int = return floor(mathrandom() * max)
+  proc random*(max: int): int = return int(floor(mathrandom() * float(max)))
   proc randomize*() = nil
   
   proc sqrt*(x: float): float {.importc: "Math.sqrt", nodecl.}
@@ -204,7 +204,7 @@ else:
   
   proc frexp*(x: float, exponent: var int): float =
     if x == 0.0:
-      exponent = 0.0
+      exponent = 0
       result = 0.0
     elif x < 0.0:
       result = -frexp(-x, exponent)