summary refs log tree commit diff stats
path: root/lib/pure/random.nim
diff options
context:
space:
mode:
authorMiran <narimiran@disroot.org>2019-06-17 20:46:04 +0200
committerAndreas Rumpf <rumpf_a@web.de>2019-06-17 20:46:04 +0200
commitac3449b93b9e7e97c2d4a75ed7f032a9fc088f80 (patch)
tree0e254bcb846714df03ec1eb201b8564fb738f327 /lib/pure/random.nim
parent6cad5c78618ad7c35147f24d35febeee124b015d (diff)
downloadNim-ac3449b93b9e7e97c2d4a75ed7f032a9fc088f80.tar.gz
[bugfix] fix #11450, random.initRand crashes in JS backend (#11522)
Diffstat (limited to 'lib/pure/random.nim')
-rw-r--r--lib/pure/random.nim8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/pure/random.nim b/lib/pure/random.nim
index bcb264151..ac38898c9 100644
--- a/lib/pure/random.nim
+++ b/lib/pure/random.nim
@@ -321,7 +321,7 @@ proc rand*[T: Ordinal or SomeFloat](r: var Rand; x: HSlice[T, T]): T =
   ## Allowed input types are:
   ## * Integer
   ## * Floats
-  ## * Enums without holes 
+  ## * Enums without holes
   ##
   ## See also:
   ## * `rand proc<#rand,HSlice[T,T]>`_ that accepts a slice and uses the
@@ -407,7 +407,7 @@ proc sample*[T](r: var Rand; s: set[T]): T =
   for e in s:
     if i == 0: return e
     dec(i)
-    
+
 proc sample*[T](s: set[T]): T =
   ## returns a random element from a set
   sample(state, s)
@@ -607,8 +607,8 @@ when not defined(nimscript):
     ## See also:
     ## * `randomize proc<#randomize,int64>`_ that accepts a seed
     ## * `initRand proc<#initRand,int64>`_
-    when defined(js):
-      let time = int64(times.epochTime() * 1_000_000_000)
+    when defined(JS):
+      let time = int64(times.epochTime() * 100_000)
       randomize(time)
     else:
       let now = times.getTime()