Pick random element: Difference between revisions
Content deleted Content added
Line 295: | Line 295: | ||
} |
} |
||
set x [randelem {1 2 3 4 5}]</lang> |
set x [randelem {1 2 3 4 5}]</lang> |
||
=={{header|TUSCRIPT}}== |
|||
<lang tuscript> |
|||
$$ MODE TUSCRIPT |
|||
list="John'Paul'George'Ringo'Peter'Paul'Mary'Obama'Putin" |
|||
sizeList=SIZE(list) |
|||
selectedNr=RANDOM_NUMBERS (1,sizeList,1) |
|||
selectedItem=SELECT(list,#selectednr) |
|||
PRINT "Selecting term ",selectedNr," in the list, which was ",selectedItem |
|||
</lang> |
|||
Output: |
|||
<pre> |
|||
Selecting term 3 in the list, which was George |
|||
</pre> |
|||
[[Category:Randomness]] |
[[Category:Randomness]] |