]> gitweb.factorcode.org Git - factor.git/commitdiff
benchmark.random: no need to write the file.
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 6 Sep 2012 14:53:41 +0000 (07:53 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 6 Sep 2012 14:53:41 +0000 (07:53 -0700)
Also, add random-unit and random-32 to benchmark.

extra/benchmark/random/random.factor

index adfa564f4bccccb1b8bb334a2487216b50938d27..1f185a1c32c61b0c87b285a2b6a69c9182587626 100644 (file)
@@ -1,16 +1,9 @@
-USING: io io.files io.files.temp io.encodings.ascii random
-math.parser math sequences ;
+USING: kernel math random ;
 IN: benchmark.random
 
-: random-numbers-path ( -- path )
-    "random-numbers.txt" temp-file ;
-
-: write-random-numbers ( n -- )
-    random-numbers-path ascii [
-        [ 200 random 100 - number>string print ] times
-    ] with-file-writer ;
-
 : random-benchmark ( -- )
-    300000 write-random-numbers ;
+    1,000,000 [
+        200 random random-unit random-32 3drop
+    ] times ;
 
 MAIN: random-benchmark