xref: /freebsd/contrib/one-true-awk/testdir/t.randk (revision 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
1{
2	k = 2
3	n = NF
4	i = 1
5	while ( i <= n ) {
6		if ( rand() < k/n ) {
7			print i
8			k--
9		}
10		n--
11		i++
12	}
13}
14