mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 11:26:18 -04:00
fix bug in knuth RNG (#1757)
* fix bug in knuth RNG * real fix, thanks ManDude * cleanup negation
This commit is contained in:
parent
2313d35800
commit
a77f8ae66d
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue