]> gitweb.factorcode.org Git - factor.git/commitdiff
random.pcg: add a unit-test
authorAlexander Ilin <alex.ilin@protonmail.com>
Sat, 21 Jan 2023 00:44:49 +0000 (01:44 +0100)
committerAlexander Ilin <alex.ilin@protonmail.com>
Sat, 21 Jan 2023 00:49:31 +0000 (01:49 +0100)
Check the first and the millionth number of the 32-bit generator for the
seed (1, 1).

extra/random/pcg/pcg-tests.factor [new file with mode: 0644]

diff --git a/extra/random/pcg/pcg-tests.factor b/extra/random/pcg/pcg-tests.factor
new file mode 100644 (file)
index 0000000..2aa1a66
--- /dev/null
@@ -0,0 +1,9 @@
+! Copyright (C) 2023 Alexander Ilin.
+! See https://factorcode.org/license.txt for BSD license.
+USING: kernel math random tools.test random.pcg ;
+IN: random.pcg.tests
+
+{ 3182460383 1446378418 } [
+    1 1 <Mwc128XXA32> dup random-32* swap
+    999999 [ dup random-32* drop ] times random-32*
+] unit-test