One of n lines in a file: Difference between revisions
Content deleted Content added
No longer draft as people seem able to follow the requirements OK. |
No edit summary |
||
Line 113:
let rec aux i r =
if i >= n then r else
if
then aux (succ i) i
else aux (succ i) r
Line 121:
let test ~n ~trials =
let ar = Array.make n 0 in
for i =
let d = one_of_n n in
ar.(d) <- succ ar.(d)
Line 159:
=={{header|Python}}==
<lang python>from random import
def one_of_n(n):
Line 165:
choice = 0
for i in range(1, n):
if
choice = i
return choice
|