Anonymous user
One of n lines in a file: Difference between revisions
Updated to work with Nim 1.4: replaced ".. <" with "..<"; replaced "import math" with "import random"; replaced "random(x+1)" with "rand(x)"; updated output.
Alextretyak (talk | contribs) m (→{{header|11l}}) |
(Updated to work with Nim 1.4: replaced ".. <" with "..<"; replaced "import math" with "import random"; replaced "random(x+1)" with "rand(x)"; updated output.) |
||
Line 1,445:
=={{header|Nim}}==
<lang nim>import
randomize()
proc oneOfN(n: int): int =
result = 0
for x in 0 ..
if random(x
result = x
Line 1,462:
echo oneOfNTest()</lang>
Output:
<pre>@[
=={{header|OCaml}}==
|