Search in sources :

Example 1 with GaussianRandomGenerator

use of org.apache.commons.math.random.GaussianRandomGenerator in project hbase by apache.

the class GaussianFileListGenerator method iterator.

@Override
public Iterator<List<StoreFile>> iterator() {
    return new Iterator<List<StoreFile>>() {

        private GaussianRandomGenerator gen = new GaussianRandomGenerator(new MersenneTwister(random.nextInt()));

        private int count = 0;

        @Override
        public boolean hasNext() {
            return count < MAX_FILE_GEN_ITERS;
        }

        @Override
        public List<StoreFile> next() {
            count += 1;
            ArrayList<StoreFile> files = new ArrayList<>(NUM_FILES_GEN);
            for (int i = 0; i < NUM_FILES_GEN; i++) {
                files.add(createMockStoreFile((int) Math.ceil(Math.max(0, gen.nextNormalizedDouble() * 32 + 32))));
            }
            return files;
        }

        @Override
        public void remove() {
        }
    };
}
Also used : GaussianRandomGenerator(org.apache.commons.math.random.GaussianRandomGenerator) Iterator(java.util.Iterator) StoreFile(org.apache.hadoop.hbase.regionserver.StoreFile) ArrayList(java.util.ArrayList) MersenneTwister(org.apache.commons.math.random.MersenneTwister)

Aggregations

ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 GaussianRandomGenerator (org.apache.commons.math.random.GaussianRandomGenerator)1 MersenneTwister (org.apache.commons.math.random.MersenneTwister)1 StoreFile (org.apache.hadoop.hbase.regionserver.StoreFile)1