Skip to main content
added 4 characters in body
Source Link

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

MATLAB (49 bytes)

@(k)eval('while k;disp(k);k=floor(rand*k);end;0')

Sample output:

>> @(k)eval('while k;disp(k);k=floor(rand*k);end;0')
ans(5)

ans = 

    @(k)eval('while k;disp(k);k=floor(rand()*k);end;0')

     5    
     3    
     2    
     1   

ans =    
     0

MATLAB (49 46 bytes)

@(k)eval('while k;disp(k);k=randi(k)-1;end;0')

Sample output:

>> @(k)eval('while k;disp(k);k=randi(k)-1;end;0')
ans(5)

ans = 

    @(k)eval('while k;disp(k);k=randi(k)-1;end;0')

     5    
     3    
     2    
     1   

ans =    
     0
Source Link

MATLAB (49 bytes)

@(k)eval('while k;disp(k);k=floor(rand*k);end;0')

Sample output:

>> @(k)eval('while k;disp(k);k=floor(rand*k);end;0')
ans(5)

ans = 

    @(k)eval('while k;disp(k);k=floor(rand()*k);end;0')

     5    
     3    
     2    
     1   

ans =    
     0