awk/testdir/t.randk
Arnold D. Robbins d6c466c367 Extract testdir.
2019-06-23 03:13:57 -06:00

14 lines
107 B
Plaintext

{
k = 2
n = NF
i = 1
while ( i <= n ) {
if ( rand() < k/n ) {
print i
k--
}
n--
i++
}
}