code: public static TransposeDataCollection weightedProbabilitySampling(AssociativeArray2D strataFrequencyTable, AssociativeArray nh, boolean withReplacement) {
          TransposeDataCollection sampledIds = new TransposeDataCollection(); 
      
          for(Map.Entry<Object, AssociativeArray> entry : strataFrequencyTable.entrySet()) {
              Object strata = entry.getKey();
              
              Number sampleN =  ((Number)nh.get(strata));
              if(sampleN==null) {
                  continue;
              }
              
              sampledIds.put(strata, SimpleRandomSampling.weightedSampling(entry.getValue(), sampleN.intValue(), withReplacement));
          }
          
          return sampledIds;
      }
docs: Samples nh ids from each strata based on their Frequency Table
  
  @param strataFrequencyTable
  @param nh
  @param withReplacement
  @return