Setting up a whole lot of testing infrastructure
[clnl] / src / main / random.lisp
index 7fca5a183d4360398f9ac129b2275067b5891da7..44a1a2af0531f6d48e40109cbfa04f9283369bc1 100644 (file)
@@ -1,7 +1,3 @@
-(defpackage #:cl-nl.random
- (:use :common-lisp)
- (:export :set-seed :next-int :next-double))
-
 (in-package #:cl-nl.random)
 
 ; This is a wrapper around the very nice mersenne twister mt19937 to match
    (+ (ash (ash y -6) 27) (ash z -5))
    (coerce (ash 1 53) 'double-float))
   n)))
+
+; Oh, export world, you WILL be mine
+(defun export ()
+ (let
+  ((state
+    (map
+     'list
+     (lambda (x) (if (logbitp (1- 32) x) (dpb x (byte 32 0) -1) x))
+     (mt19937::random-state-state mt19937:*random-state*))))
+  (format nil "0 ~A ~A ~A 0.0 false 1 ~{~A~^ ~}"
+   (first state) (second state) (third state)
+   (nthcdr 4 state))))