Created
May 21, 2012 22:40
-
-
Save daniel-cussen/2765159 to your computer and use it in GitHub Desktop.
Roll the dice four or five times and get yourself a new random-state
This file contains hidden or 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
(defun converter (d20 d12 d10 d8 d4) | |
(let ((prod (+ (* 3840 (1- d20)) | |
(* 320 (1- d12)) | |
(* 32 (1- d10)) | |
(* 4 (1- d8)) | |
(1- d4)))) | |
(if (> prod 65535) | |
nil | |
(format nil "~4,'0X" prod)))) | |
(defun random-state-maker (integer) | |
(eval (read-from-string (format nil "#S(random-state #*~64,'0B)" integer)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment