Partition an array into approximately equal-sized chunks