### Question:
ClusterSampling { 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; }  static double nBar(TransposeDataList clusterIdList); static TransposeDataCollection randomSampling(TransposeDataList clusterIdList, int sampleM); static double mean(TransposeDataCollection sampleDataCollection); static double xbarVariance(TransposeDataCollection sampleDataCollection, int populationM, double Nbar); static double xbarStd(TransposeDataCollection sampleDataCollection, int populationM, double Nbar);  }### Answer:
@Test public void testRandomSampling() { logger.info("randomSampling"); TransposeDataList clusterIdList = generateClusterIdList(); int sampleM = 2; double expResult = sampleM; TransposeDataCollection sampledIds = ClusterSampling.randomSampling(clusterIdList, sampleM); double result = sampledIds.size(); assertEquals(expResult, result, Constants.DOUBLE_ACCURACY_HIGH); }