Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Random list element.

  • Loading branch information...
commit 1c3ad3d3cdea9bfc72037156eacd52c52258f5b6 1 parent 4555f0c
@dardoria authored
Showing with 6 additions and 2 deletions.
  1. +2 −1  package.lisp
  2. +4 −1 utils.lisp
View
3  package.lisp
@@ -101,4 +101,5 @@
#:make-curve
;;utils
#:radian
- #:random-range))
+ #:random-range
+ #:random-element))
View
5 utils.lisp
@@ -36,4 +36,7 @@
(let ((range (- y x)))
(when (rationalp range)
(setf range (coerce range 'float)))
- (+ x (random range ))))))
+ (+ x (random range ))))))
+
+(defun random-element (sequence)
+ (nth (random (length sequence)) sequence))
Please sign in to comment.
Something went wrong with that request. Please try again.