1*9a7741deSElliott Hughes{ 2*9a7741deSElliott Hughes k = 2 3*9a7741deSElliott Hughes n = NF 4*9a7741deSElliott Hughes i = 1 5*9a7741deSElliott Hughes while ( i <= n ) { 6*9a7741deSElliott Hughes if ( rand() < k/n ) { 7*9a7741deSElliott Hughes print i 8*9a7741deSElliott Hughes k-- 9*9a7741deSElliott Hughes } 10*9a7741deSElliott Hughes n-- 11*9a7741deSElliott Hughes i++ 12*9a7741deSElliott Hughes } 13*9a7741deSElliott Hughes} 14