projects
/
clnl
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Shufflerator now shuffles like the NL one does!
[clnl]
/
src
/
main
/
random.lisp
diff --git
a/src/main/random.lisp
b/src/main/random.lisp
index 508cb6b798681abaced12cfa0a3e2b813928c394..6c9ecaa7c6fd42b6d4cba8653d665b74a42c29a2 100644
(file)
--- a/
src/main/random.lisp
+++ b/
src/main/random.lisp
@@
-7,7
+7,10
@@
(setf mt19937:*random-state* (mt19937::make-random-object :state (mt19937:init-random-state n))))
(defun next-int (n)
(setf mt19937:*random-state* (mt19937::make-random-object :state (mt19937:init-random-state n))))
(defun next-int (n)
- (rem (ash (mt19937:random-chunk mt19937:*random-state*) -1) n))
+ (if
+ (= n (logand n (- n) ))
+ (ash (* n (ash (mt19937:random-chunk mt19937:*random-state*) -1) ) -31)
+ (rem (ash (mt19937:random-chunk mt19937:*random-state*) -1) n)))
(defun next-double (&optional (n 1d0))
(let
(defun next-double (&optional (n 1d0))
(let