Re: Random generator
Bernd Beuster <[email protected]> Sat, 1 Sep 2007 12:31:41 +0200
| Newsgroups | gmane.lisp.openmcl.bugs |
|---|---|
| Message-ID | <[email protected]> |
--Apple-Mail-3--117896169
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
delsp=yes;
format=flowed
Here's the patch in diff -u format. Also, the comment about the
algorithm has been corrected in ccl/l0-number
--- ccl/level-0/l0-numbers.lisp.~1.31.~ 2007-04-09 08:39:15.000000000
+0200
+++ ccl/level-0/l0-numbers.lisp 2007-09-01 12:14:56.000000000 +0200
@@ -1770,7 +1770,7 @@
ab mod m = u + v : u+v < 2^n
ab mod m = ((u + v) mod 2^n) + 1 : u+v >= 2^n
-What we do is use 2b and 2n so we can do arithemetic mod 2^32
instead of
+What we do is use 2b and 2^n so we can do arithemetic mod 2^32
instead of
2^31. This reduces the whole generator to 5 instructions on the
680x0 or
80x86, and 8 on the 60x.
@@ -1782,7 +1782,7 @@
(defun %next-random-pair (high low)
(let* ((n (nth-value
1
- (%multiply 42871 (dpb (ldb (byte 15 0) high)
+ (%multiply 48271 (dpb (ldb (byte 15 0) high)
(byte 16 16)
(ldb (byte 16 0) low ))))))
(values (ldb (byte 16 16) n)
--- ccl/level-0/PPC/ppc-numbers.lisp.~1.16.~ 2007-04-09
08:39:15.000000000 +0200
+++ ccl/level-0/PPC/ppc-numbers.lisp 2007-09-01 12:22:19.000000000 +0200
@@ -312,7 +312,7 @@
ab mod m = u + v : u+v < 2^n
ab mod m = ((u + v) mod 2^n) + 1 : u+v >= 2^n
-What we do is use 2b and 2n so we can do arithemetic mod 2^32
instead of
+What we do is use 2b and 2^n so we can do arithemetic mod 2^32
instead of
2^31. This reduces the whole generator to 5 instructions on the
680x0 or
80x86, and 8 on the 60x.
--Apple-Mail-3--117896169
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream; x-unix-mode=0644; name=l0-numbers.patch
Content-Disposition: attachment;
filename=l0-numbers.patch
--- ccl/level-0/l0-numbers.lisp.~1.31.~ 2007-04-09 08:39:15.000000000 +0200
+++ ccl/level-0/l0-numbers.lisp 2007-09-01 12:14:56.000000000 +0200
@@ -1770,7 +1770,7 @@
ab mod m = u + v : u+v < 2^n
ab mod m = ((u + v) mod 2^n) + 1 : u+v >= 2^n
-What we do is use 2b and 2n so we can do arithemetic mod 2^32 instead of
+What we do is use 2b and 2^n so we can do arithemetic mod 2^32 instead of
2^31. This reduces the whole generator to 5 instructions on the 680x0 or
80x86, and 8 on the 60x.
@@ -1782,7 +1782,7 @@
(defun %next-random-pair (high low)
(let* ((n (nth-value
1
- (%multiply 42871 (dpb (ldb (byte 15 0) high)
+ (%multiply 48271 (dpb (ldb (byte 15 0) high)
(byte 16 16)
(ldb (byte 16 0) low ))))))
(values (ldb (byte 16 16) n)
--- ccl/level-0/PPC/ppc-numbers.lisp.~1.16.~ 2007-04-09 08:39:15.000000000 +0200
+++ ccl/level-0/PPC/ppc-numbers.lisp 2007-09-01 12:22:19.000000000 +0200
@@ -312,7 +312,7 @@
ab mod m = u + v : u+v < 2^n
ab mod m = ((u + v) mod 2^n) + 1 : u+v >= 2^n
-What we do is use 2b and 2n so we can do arithemetic mod 2^32 instead of
+What we do is use 2b and 2^n so we can do arithemetic mod 2^32 instead of
2^31. This reduces the whole generator to 5 instructions on the 680x0 or
80x86, and 8 on the 60x.
--Apple-Mail-3--117896169
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
--
Bernd
--Apple-Mail-3--117896169
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Bug-openmcl mailing list
[email protected]
http://clozure.com/mailman/listinfo/bug-openmcl
--Apple-Mail-3--117896169--