mirror of
https://github.com/open-goal/jak-project
synced 2026-07-25 22:31:06 -04:00
fix bug in knuth RNG (#1757)
* fix bug in knuth RNG * real fix, thanks ManDude * cleanup negation
This commit is contained in:
@@ -60,9 +60,9 @@
|
||||
(val 0))
|
||||
|
||||
;; if ((bound & -bound) == bound) // i.e., bound is a power of 2
|
||||
(if (= (logand bound (* -1 bound)) bound)
|
||||
(if (= (logand bound (- bound)) bound)
|
||||
;; return (int)((bound * (long)next(31)) >> 31);
|
||||
(return (sar (* bound (knuth-rand-next 31)) 31))
|
||||
(return (+ min (sar (imul64 bound (knuth-rand-next 31)) 31)))
|
||||
)
|
||||
|
||||
;; do {
|
||||
|
||||
Reference in New Issue
Block a user