awk/testdir/t.randk

14 lines
107 B
Plaintext
Raw Normal View History

2019-06-23 05:13:57 -04:00
{
k = 2
n = NF
i = 1
while ( i <= n ) {
if ( rand() < k/n ) {
print i
k--
}
n--
i++
}
}