Created
January 29, 2014 16:01
-
-
Save kliph/8691093 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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