Skip to content

Instantly share code, notes, and snippets.

@kliph
Created January 29, 2014 16:01
Show Gist options
  • Save kliph/8691093 to your computer and use it in GitHub Desktop.
Save kliph/8691093 to your computer and use it in GitHub Desktop.
(defvar R1)
(defvar R2)
(defvar R3)
(defvar R4)
(defun snesrand (&optional seed)
"Based on
https://github.com/optixx/snes/blob/master/libs/RANDOM.ASM "
(cond (seed
(setq R1 (ash seed -12))
(setq R2 (ash seed -8))
(setq R3 (ash seed -4))
(setq R4 seed)
R1)
(t
(setq R4 R3)
(setq R3 R2)
(setq R2 R1)
(cond ((> R2 R3)
(setq R1 (+ R3 R4)))
(t
(setq R1 (+ R2 R4))))
R1)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment