public static RunStats delegateGetBucketForDouble(int buckets) throws Exception {
  Long startTime=System.currentTimeMillis();
  PrimaryIndexBucketGeneratorImpl ibg=new PrimaryIndexBucketGeneratorImpl(FieldDataType.DOUBLE,buckets);
  PrimaryIndexBucketLocatorImpl locator=new PrimaryIndexBucketLocatorImpl(null,null,ibg.generateBuckets(),null,null,null,null,null,null);
  logger.debug("test to getBucket for the bucket distribution on Double values");
  HashMap<Long,List<Object>> hm=new HashMap<>();
  SummaryStatistics stats=new SummaryStatistics();
  NormalDistribution dist=new NormalDistribution(0,6);
  Random r=new Random();
  for (int i=0; i < 20000; i++) {
    double normalRandom=dist.sample();
    double scaleRandom=Math.random();
    if (scaleRandom < .25) {
      normalRandom=normalRandom * 10;
    }
 else     if (scaleRandom < .5) {
      normalRandom=normalRandom * 500;
    }
 else     if (scaleRandom < .75) {
      normalRandom=normalRandom * 125000;
    }
 else {
      normalRandom=normalRandom * 1250000;
    }
    Long bucketId=locator.getBucket(normalRandom,FieldDataType.DOUBLE);
    calculate(hm,stats,bucketId,normalRandom);
  }
  Long runTime=System.currentTimeMillis() - startTime;
  RunStats runStats=new RunStats("BucketForDouble",FieldDataType.DOUBLE,runTime,stats,hm);
  logger.debug(runStats.toString());
  return runStats;
}

public static RunStats delegateGetBucketForDouble ( int buckets ) throws Exception { Long startTime = System . currentTimeMillis ( ) ; PrimaryIndexBucketGeneratorImpl ibg = new PrimaryIndexBucketGeneratorImpl ( FieldDataType . DOUBLE , buckets ) ; PrimaryIndexBucketLocatorImpl locator = new PrimaryIndexBucketLocatorImpl ( null , null , ibg . generateBuckets ( ) , null , null , null , null , null , null ) ; logger . debug ( "test to getBucket for the bucket distribution on Double values" ) ; HashMap < Long , List < Object > > hm = new HashMap < > ( ) ; SummaryStatistics stats = new SummaryStatistics ( ) ; NormalDistribution dist = new NormalDistribution ( 0 , 6 ) ; Random r = new Random ( ) ; for ( int i = 0 ; i < 20000 ; i ++ ) { double normalRandom = dist . sample ( ) ; double scaleRandom = Math . random ( ) ; if ( scaleRandom < .25 ) { normalRandom = normalRandom * 10 ; } else if ( scaleRandom < .5 ) { normalRandom = normalRandom * 500 ; } else if ( scaleRandom < .75 ) { normalRandom = normalRandom * 125000 ; } else { normalRandom = normalRandom * 1250000 ; } Long bucketId = locator . getBucket ( normalRandom , FieldDataType . DOUBLE ) ; calculate ( hm , stats , bucketId , normalRandom ) ; } Long runTime = System . currentTimeMillis ( ) - startTime ; RunStats runStats = new RunStats ( "BucketForDouble" , FieldDataType . DOUBLE , runTime , stats , hm ) ; logger . debug ( runStats . toString ( ) ) ; return runStats ; }
test to check the bucket distribution for the double values
