- ((integer 1 #.(expt 2 n-random-chunk-bits)) &optional *))
- "optimize to single-RANDOM-CHUNK operations"
+ ((integer 1 #.(ash 1 sb!vm:n-word-bits)) &optional *))
+ "transform to a sample no wider than CPU word"
(let ((type (lvar-type limit)))
(if (numeric-type-p type)
(let ((limit-high (numeric-type-high (lvar-type limit))))
(let ((type (lvar-type limit)))
(if (numeric-type-p type)
(let ((limit-high (numeric-type-high (lvar-type limit))))
(deftransform %inclusive-random-integer
((inclusive-limit state) (* *) * :policy (> speed space))
;; By the way, some natural special cases (notably when the user is
(deftransform %inclusive-random-integer
((inclusive-limit state) (* *) * :policy (> speed space))
;; By the way, some natural special cases (notably when the user is
;; code (with no test and loop) if someone finds it important.
'(let ((n-bits (integer-length inclusive-limit)))
(%inclusive-random-integer-accept-reject (%random-bits n-bits state)
;; code (with no test and loop) if someone finds it important.
'(let ((n-bits (integer-length inclusive-limit)))
(%inclusive-random-integer-accept-reject (%random-bits n-bits state)