]> gitweb.factorcode.org Git - factor.git/commitdiff
random.rdrand: adding RDRAND random generator.
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 25 Apr 2013 21:39:38 +0000 (14:39 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 25 Apr 2013 21:39:38 +0000 (14:39 -0700)
extra/random/rdrand/authors.txt [new file with mode: 0644]
extra/random/rdrand/rdrand.factor [new file with mode: 0644]
extra/random/rdrand/summary.txt [new file with mode: 0644]

diff --git a/extra/random/rdrand/authors.txt b/extra/random/rdrand/authors.txt
new file mode 100644 (file)
index 0000000..e091bb8
--- /dev/null
@@ -0,0 +1 @@
+John Benediktsson
diff --git a/extra/random/rdrand/rdrand.factor b/extra/random/rdrand/rdrand.factor
new file mode 100644 (file)
index 0000000..a164214
--- /dev/null
@@ -0,0 +1,13 @@
+! Copyright (C) 2013 John Benediktsson
+! See http://factorcode.org/license.txt for BSD license
+
+USING: cpu.x86.features kernel random ;
+
+IN: random.rdrand
+
+SINGLETON: rdrand
+
+M: rdrand random-32* drop rdrand32 ;
+
+: with-rdrand ( quot -- )
+    [ rdrand ] dip with-random ; inline
diff --git a/extra/random/rdrand/summary.txt b/extra/random/rdrand/summary.txt
new file mode 100644 (file)
index 0000000..b51c359
--- /dev/null
@@ -0,0 +1 @@
+RDRAND random generator