RosettaCodeData/Task/Pick-random-element/Emacs-Lisp/pick-random-element.l

6 lines
110 B
Common Lisp

(defun random-choice (items)
(nth (random (length items)) items))
(random-choice '("a" "b" "c"))
;; => "a"