Here's a more tacit version with repetitions
 
toss3=: 4 : 0"0
  n=. #y=. ((>.x^.y) # x) #: y-1
  if. n > i=. >:y (> i. 1:) r=. ?y+1 do.
    r=. (i{.r) , ? (n-i) # x end.
  x#.r
)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to