// Batch returns a slice with n broken into batches of size batchSize.
Batch returns a slice with n broken into batches of size batchSize.
// Batch returns a slice with n broken into batches of size batchSize .
func Batch(n, batchSize int) []int {
	fullBatches := n / batchSize
	batches := make([]int, 0, fullBatches+1)
	for i := 0; i < fullBatches; i++ {
		batches = append(batches, batchSize)
	}
	if remaining := n % batchSize; remaining > 0 {
		batches = append(batches, remaining)
	}
	return batches
}
func Batch ( n , batchSize int ) [ ] int { fullBatches := n / batchSize batches := make ( [ ] int , 0 , fullBatches + 1 ) for i := 0 ; i < fullBatches ; i ++ { batches = append ( batches , batchSize ) } if remaining := n % batchSize ; remaining > 0 { batches = append ( batches , remaining ) } return batches }
Batch returns a slice with n broken into batches of size batchSize.
Batch returns a slice with n broken into batches of size batchSize .