(defun non-fixed-permutations (l) (defun non-fixed-mappings (from to acc) (if from (do ((remaining to (cdr remaining)) (done nil) (results nil)) ((not remaining) results) (if (not (equal (car from) (car remaining))) (setf results (append results (non-fixed-mappings (cdr from) (append done (cdr remaining)) (append acc (list (car remaining))))))) (setf done (append done (list (car remaining))))) (list acc))) (non-fixed-mappings l l nil)) (defun random-non-fixed-permutation (l) (let ((permutations (non-fixed-permutations l))) (elt permutations (random (length permutations)))))