Pick random element: Difference between revisions

Updated to work with Nim 1.4: replaced "ls.rand()" with "sample(ls)". Added missing "import random" statement.
m (added whitespace before the TOC. .)
(Updated to work with Nim 1.4: replaced "ls.rand()" with "sample(ls)". Added missing "import random" statement.)
Line 812:
 
=={{header|Nim}}==
<lang nim>randomize()import random
randomize()
 
let ls = @["foo", "bar", "baz"]
echo ls.randsample(ls)</lang>
 
=={{header|Objeck}}==
Anonymous user