One of n lines in a file: Difference between revisions
Content deleted Content added
m →{{header|Phix}}: syntax coloured |
Drkameleon (talk | contribs) Added Arturo implementation |
||
Line 168:
130 NEXT I
140 RETURN</lang>
=={{header|Arturo}}==
<lang rebol>oneOfN: function [n][
result: 0
loop 0..dec n 'x [
if zero? random 0 x ->
result: x
]
return result
]
oneOfNTest: function [n,trials][
ret: array.of:n 0
if n > 0 [
loop 1..trials 'i [
oon: oneOfN n
ret\[oon]: ret\[oon] + 1
]
]
return ret
]
print oneOfNTest 10 1000000</lang>
{{out}}
<pre>100120 100126 99975 99847 100235 100238 99528 99956 100038 99937</pre>
=={{header|AutoHotkey}}==
|