Package java.util

Examples of java.util.Random.nextLong()


    int blockX = chunkX * 16;
    int blockY = minY;
    int blockZ = chunkZ * 16;

    Random dRand = new Random(world.getSeed());
    long l = (dRand.nextLong() / 2L) * 2L + 1L;
    long l1 = (dRand.nextLong() / 2L) * 2L + 1L;
    dRand.setSeed(chunkX * l + chunkZ * l1 ^ world.getSeed());

    boolean generated = false;
    for (int i = count; i --> 0; ) {
View Full Code Here


    int blockY = minY;
    int blockZ = chunkZ * 16;

    Random dRand = new Random(world.getSeed());
    long l = (dRand.nextLong() / 2L) * 2L + 1L;
    long l1 = (dRand.nextLong() / 2L) * 2L + 1L;
    dRand.setSeed(chunkX * l + chunkZ * l1 ^ world.getSeed());

    boolean generated = false;
    for (int i = count; i --> 0; ) {
      int x = blockX + getDensity(dRand, veinDiameter, horizontalDensity);
View Full Code Here

        final BigEndianAscendingWordDeserializer deserializer =
            new BigEndianAscendingWordDeserializer(wordLength, bytePadding, bytes);

        assertEquals(deserializer.totalWordCount(), wordCount);
        for(int i=0; i<wordCount; i++) {
            assertEquals(deserializer.readWord(), (verificationRandom.nextLong() & wordMask));
        }
    }

    /**
     * Runs a test which serializes and deserializes ascending (from zero) word values.
View Full Code Here

    public void serializationSmokeTest() throws Exception {
        final Random random = new Random(RANDOM_SEED);
        final int randomCount = 250;
        final List<Long> randoms = new ArrayList<Long>(randomCount){{
            for (int i=0; i<randomCount; i++) {
                add(random.nextLong());
            }
        }};

        assertCardinality(HLLType.EMPTY, randoms);
        assertCardinality(HLLType.EXPLICIT, randoms);
View Full Code Here

        // the accumulator, starts empty
        final HLL hll = newHLL(HLLType.EMPTY);
        initLineAdd(output, hll, schemaVersion);

        for(int i=0; i<10000/*arbitrary*/; i++) {
            cumulativeAddLine(output, hll, random.nextLong(), schemaVersion);
        }

        output.flush();
        output.close();
    }
View Full Code Here

        cumulativeUnionLine(output, hll, emptyHLL, schemaVersion);

        for(int i=0; i<(EXPLICIT_THRESHOLD+500)/*should be greater than promotion cutoff*/; i++) {
            // make an EXPLICIT set and populate with cardinality 1
            final HLL explicitHLL = newHLL(HLLType.EXPLICIT);
            explicitHLL.addRaw(random.nextLong());

            cumulativeUnionLine(output, hll, explicitHLL, schemaVersion);
        }

        output.flush();
View Full Code Here

        cumulativeUnionLine(output, hll, emptyHLL, schemaVersion);

        for(int i=0; i<EXPLICIT_THRESHOLD; i++) {
            // make an EXPLICIT set and populate with cardinality 1
            final HLL explicitHLL = newHLL(HLLType.EXPLICIT);
            explicitHLL.addRaw(random.nextLong());

            // union it into the accumulator twice, to test overlap (cardinality should not change)
            cumulativeUnionLine(output, hll, explicitHLL, schemaVersion);
            cumulativeUnionLine(output, hll, explicitHLL, schemaVersion);
        }
View Full Code Here

        for(int i=0; i<1000/*number of rows to generate*/; i++) {
            // make a FULL set and populate with
            final HLL fullHLL = newHLL(HLLType.FULL);
            final int elementCount = random.nextInt(10000/*arbitrary maximum cardinality*/);
            for(int j=0;j<elementCount;j++) {
                fullHLL.addRaw(random.nextLong());
            }

            cumulativeUnionLine(output, hll, fullHLL, schemaVersion);
        }

View Full Code Here

        final HLL hll = newHLL(explicitThreshold);

        final long seed = 1L/*constant so results are reproducible*/;
        final Random random = new Random(seed);
        for(int i=0;i<explicitThreshold;i++){
            long randomLong = random.nextLong();
            canonical.add(new Long(randomLong));
            hll.addRaw(randomLong);
        }
        final int canonicalCardinality = canonical.size();
        assertEquals(hll.cardinality(), canonicalCardinality);
View Full Code Here

            final Int2ByteOpenHashMap map = new Int2ByteOpenHashMap();
            map.defaultReturnValue((byte)0);

            for(int i=0; i<sparseThreshold; i++) {
                final long rawValue = random.nextLong();

                final short registerIndex = ProbabilisticTestUtil.getRegisterIndex(rawValue, log2m);
                final byte registerValue = ProbabilisticTestUtil.getRegisterValue(rawValue, log2m);
                if(map.get(registerIndex) < registerValue) {
                    map.put(registerIndex, registerValue);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.