One of n lines in a file: Difference between revisions

Added Easylang
m (→‎{{header|Wren}}: Minor tidy)
(Added Easylang)
 
Line 604:
=={{header|Delphi}}==
See [https://rosettacode.org/wiki/One_of_n_lines_in_a_file#Pascal Pascal].
=={{header|EasyLang}}==
{{trans|Lua}}
<syntaxhighlight>
n = 10
trials = 1000000
func one n .
for i = 1 to n
if randomf < 1 / i
chosen = i
.
.
return chosen
.
len results[] n
for i = 1 to trials
r = one n
results[r] += 1
.
print "Value Occurrences"
print "-------------------"
for i to n
print i & "\t" & results[i]
.
</syntaxhighlight>
 
=={{header|Eiffel}}==
<syntaxhighlight lang="eiffel">
1,982

edits