From: Jeff Clough <jeff@chaosphere.com>
Date: Wed, 18 Nov 2009 07:54:28 -0500 (EST)
(defun get-random-element (list)
"Returns a random element of LIST."
(if (not (and (list) (listp list)))
(nth (random (1- (1+ (length list)))) list)
(error "Argument to get-random-element not a list or the list is empty")))
Yay for not being awake! The above should be this:
(defun get-random-element (list)
"Returns a random element of LIST."
(if (and list (listp list))
(nth (random (1- (1+ (length list)))) list)
(error "Argument to get-random-element not a list or the list is empty")))