code: function cross_validation_split(dataset = [], options = {
                folds: 3,
                random_state: 0,
              }) { //kfolds
                const engine = random.engines.mt19937().seed(options.random_state || 0);
                const folds = options.folds || 3;
                const dataset_split = [];
                const dataset_copy = [].concat(dataset);
                const foldsize = parseInt(dataset.length / (folds || 3), 10);
                for (let i in lodash_range(folds)) {
                  const fold = [];
                  while (fold.length < foldsize) {
                    const index = random.integer(0, (dataset_copy.length - 1))(engine);
                    fold.push(dataset_copy.splice(index, 1)[0]);
                  }
                  dataset_split.push(fold);
                }
  
                return dataset_split;
              }
docs: Provides train/test indices to split data in train/test sets. Split dataset into k consecutive folds.
  Each fold is then used once as a validation while the k - 1 remaining folds form the training set.
  @memberOf cross_validation
  @example
  const testArray = [20, 25, 10, 33, 50, 42, 19, 34, 90, 23, ];
  [ [ 50, 20, 34, 33, 10 ], [ 23, 90, 42, 19, 25 ] ]
  const crossValidationArrayKFolds = ms.cross_validation.cross_validation_split(testArray, { folds: 2, random_state: 0, });
  @param {array} dataset - array of data to split
  @param {object} options
  @param {number} [options.folds=3] - Number of folds
  @param {number} [options.random_state=0] - the seed used by the random number generator
  @returns {array} returns  dataset split into k consecutive folds