I've found this similar two questions to the one I'm about to ask:
Split array up into n-groups of m size? and Need to split arrays to sub arrays of specified size in Ruby
This splits array into three arrays with each array having three elements :
a.each_slice(3) do |x,y,z|
p [x,y,z]
end
So if I do this (my array size is 1000) :
a.each_slice(200) do |a,b,c,d,e|
p "#{a} #{b} #{c} #{d} #{e}"
end
This should split my array into 5 arrays each having 200 members? But it doesn't? What I actually need to do is to put 200 random elements into 5 arrays, am I on the right track here, how can I do this?