C++ function to create random balanced indices for using in K-Fold cross validation