code: public static TransposeDataCollection randomSampling(TransposeDataList clusterIdList, int sampleM) {
          TransposeDataCollection sampledIds = new TransposeDataCollection(); 
          
          Object[] selectedClusters = clusterIdList.keySet().toArray();
          PHPMethods.<Object>shuffle(selectedClusters);
          
          for(int i = 0; i<sampleM; ++i) {
              Object cluster = selectedClusters[i];
              sampledIds.put(cluster, clusterIdList.get(cluster).toFlatDataCollection());
          }
          
          
          return sampledIds;
      }
docs: Samples m clusters by using Cluster Sampling
  
  @param clusterIdList
  @param sampleM
  @return