aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Pouar <pouar@pouar.net>2020-10-02 12:00:03 -0500
committerGravatar Pouar <pouar@pouar.net>2020-10-02 12:00:03 -0500
commitf64b26d6af619906a1b0f57b26b7178a761c4bba (patch)
tree11cd65af20fe8ca03ed4e8557f47ca26f6d824a8
parentthis is no longer relevant (diff)
add random-from-range back
-rw-r--r--core/util.lisp5
-rw-r--r--packages.lisp1
2 files changed, 6 insertions, 0 deletions
diff --git a/core/util.lisp b/core/util.lisp
index aa6a41c..6fd2e79 100644
--- a/core/util.lisp
+++ b/core/util.lisp
@@ -133,3 +133,8 @@ argument.")
((or docstring declare)
(cdr body))
(t body))))))
+(declaim (ftype (function (t t) (values real &optional)) random-from-range))
+(defun random-from-range (from to)
+ (s:random-in-range from (1+ to)))
+(define-compiler-macro random-from-range (from to)
+ `(values (s:random-in-range ,from ,to)))
diff --git a/packages.lisp b/packages.lisp
index 0a2a221..e4c1e03 100644
--- a/packages.lisp
+++ b/packages.lisp
@@ -22,6 +22,7 @@
#:sum*
#:defunassert
#:lappendf
+ #:random-from-range
#:print-unreadable-object-with-prefix)
(:documentation "Utility functions that aren't really part of the game's API")
(:local-nicknames (:s :serapeum) (:a :alexandria) (:u :ugly-tiny-infix-macro) (:g :global-vars)