code: public List<Type> randomSplit(Random rand, double... splits)
      {
          if(splits.length < 1)
              throw new IllegalArgumentException("Input array of split fractions must be non-empty");
          IntList randOrder = new IntList(size());
          ListUtils.addRange(randOrder, 0, size(), 1);
          Collections.shuffle(randOrder, rand);
          
          
          int[] stops = new int[splits.length];
          double sum = 0;
          for(int i = 0; i < splits.length; i++)
          {
              sum += splits[i];
              if(sum >= 1.001/*some flex room for numeric issues*/)
                  throw new IllegalArgumentException("Input splits sum is greater than 1 by index " + i + " reaching a sum of " + sum);
              stops[i] = (int) Math.round(sum*randOrder.size());
          }
          
          List<Type> datasets = new ArrayList<>(splits.length);
          
          int prev = 0;
          for(int i = 0; i < stops.length; i++)
          {
              datasets.add(getSubset(randOrder.subList(prev, stops[i])));
              prev = stops[i];
          }
          
          return datasets;
      }
docs: Splits the dataset randomly into proportionally sized partitions.
  
  @param rand the source of randomness for moving data around
  @param splits any array, where the length is the number of datasets to
  create and the value of in each index is the fraction of samples that
  should be placed into that dataset. The sum of values must be less than
  or equal to 1.0
  @return a list of new datasets