MATLAB (4949 46 bytes)
@(k)eval('while k;disp(k);k=floor;k=randi(rand*kk);end;0'-1;end;0')
Sample output:
>> @(k)eval('while k;disp(k);k=floor;k=randi(rand*kk);end;0'-1;end;0')
ans(5)
ans =
@(k)eval('while k;disp(k);k=floor(rand;k=randi()*kk);end;0'-1;end;0')
5
3
2
1
ans =
0