Permalink
Browse files

Random list element.

  • Loading branch information...
dardoria committed Mar 1, 2012
1 parent 4555f0c commit 1c3ad3d3cdea9bfc72037156eacd52c52258f5b6
Showing with 6 additions and 2 deletions.
  1. +2 −1 package.lisp
  2. +4 −1 utils.lisp
View
@@ -101,4 +101,5 @@
#:make-curve
;;utils
#:radian
- #:random-range))
+ #:random-range
+ #:random-element))
View
@@ -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))

0 comments on commit 1c3ad3d

Please sign in to comment.