If you are wanting different sized samples I suggest you write SAMPLES so it
works for unboxed arguments. Then
SAMPLES =: 4 : 0 "0 _
n =. +/ y
v =. y # i.#y
(?x#n){v
)
10 20 SAMPLES&.:> "0 _ ] 4 2 7 6
+-------------------+---------------------------------------+
|2 0 0 2 0 1 2 0 3 3|3 1 2 1 0 2 0 3 1 3 1 0 3 3 3 3 2 2 2 2|
+-------------------+---------------------------------------+
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm