Pick random element: Difference between revisions
Content deleted Content added
Logo |
|||
Line 1: | Line 1: | ||
{{task|Basic language learning}} |
{{task|Basic language learning}} |
||
Demonstrate how to pick a random element from a list. |
Demonstrate how to pick a random element from a list. |
||
=={{header|ACL2}}== |
|||
<lang Lisp>:set-state-ok t |
|||
(defun pick-random-element (xs state) |
|||
(mv-let (idx state) |
|||
(random$ (len xs) state) |
|||
(mv (nth idx xs) state)))</lang> |
|||
=={{header|Ada}}== |
=={{header|Ada}}== |