private static void sparseRandomTest(final ISchemaVersion schemaVersion) throws IOException {
  final Writer output=openOutput(schemaVersion,"sparse_random",TestType.ADD);
  final Random random=new Random(randomLong());
  final HLL hll=newHLL(HLLType.SPARSE);
  initLineAdd(output,hll,schemaVersion);
  for (int i=0; i < SPARSE_THRESHOLD; i++) {
    final int registerIndex=Math.abs(random.nextInt()) % REGISTER_COUNT;
    final int registerValue=((Math.abs(random.nextInt()) % REGISTER_MAX_VALUE) + 1);
    final long rawValue=constructHLLValue(LOG2M,registerIndex,registerValue);
    cumulativeAddLine(output,hll,rawValue,schemaVersion);
  }
  output.flush();
  output.close();
}

private static void sparseRandomTest ( final ISchemaVersion schemaVersion ) throws IOException { final Writer output = openOutput ( schemaVersion , "sparse_random" , TestType . ADD ) ; final Random random = new Random ( randomLong ( ) ) ; final HLL hll = newHLL ( HLLType . SPARSE ) ; initLineAdd ( output , hll , schemaVersion ) ; for ( int i = 0 ; i < SPARSE_THRESHOLD ; i ++ ) { final int registerIndex = Math . abs ( random . nextInt ( ) ) % REGISTER_COUNT ; final int registerValue = ( ( Math . abs ( random . nextInt ( ) ) % REGISTER_MAX_VALUE ) + 1 ) ; final long rawValue = constructHLLValue ( LOG2M , registerIndex , registerValue ) ; cumulativeAddLine ( output , hll , rawValue , schemaVersion ) ; } output . flush ( ) ; output . close ( ) ; }
cumulatively sets random registers of a sparse hll to random values by adding random values . does not induce promotion . format : cumulative add tests : - sparse addition ( random )
