Last active
April 7, 2025 15:08
-
-
Save fogus/4b73cceec36b3ac009a27dc907e9b961 to your computer and use it in GitHub Desktop.
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
(defn range-3d6 | |
"A function to return the possible rolls with 3d6 between start and end inclusive." | |
([n] (list n)) | |
([start end] | |
(for [d100s (range 1 7) | |
d10s (range 1 7) | |
d1s (range 1 7) | |
:let [num (+ (* 100 d100s) (* 10 d10s) d1s)] | |
:when (and (<= start num) (<= num end))] | |
num))) | |
(range-3d6 111 666) | |
;;=> (111 112 ... 665 666) | |
(range-3d6 111) | |
;;=> (111) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment