summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authorJason Livesay <ithkuil@gmail.com>2014-03-26 18:54:34 -0700
committerJason Livesay <ithkuil@gmail.com>2014-03-26 18:54:34 -0700
commitcabc5c80d36bc515ffbc6787995aac7886cdcfc6 (patch)
treea2d937b1057efe3a06fed4d95a9a8707c59e8a1d /lib/pure
parentdc956c485aa9d8becd3d9eb3c2086ebac3b6eeed (diff)
downloadNim-cabc5c80d36bc515ffbc6787995aac7886cdcfc6.tar.gz
Calling randomize() again within 1 second will now provide a different seed
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/math.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/pure/math.nim b/lib/pure/math.nim
index 062cfae25..94570fc68 100644
--- a/lib/pure/math.nim
+++ b/lib/pure/math.nim
@@ -20,6 +20,8 @@
 when defined(Posix) and not defined(haiku):
   {.passl: "-lm".}
 
+import times
+
 const
   PI* = 3.1415926535897932384626433 ## the circle constant PI (Ludolph's number)
   E* = 2.71828182845904523536028747 ## Euler's number
@@ -201,7 +203,7 @@ when not defined(JS):
       result = drand48() * max
     
   proc randomize() =
-    randomize(gettime(nil))
+    randomize(cast[int](epochTime()))
 
   proc randomize(seed: int) =
     srand(cint(seed))