Package org.terasology.utilities.random

Examples of org.terasology.utilities.random.MersenneRandom.nextInt()


        MersenneRandom r = new MersenneRandom(seed);

        // warmup
        sum = 0;
        for (int j = 0; j < warmUpCount; j++) {
            sum += r.nextInt();
        }

        sum = 0;
        start = System.nanoTime();
        for (int j = 0; j < count; j++) {
View Full Code Here


        }

        sum = 0;
        start = System.nanoTime();
        for (int j = 0; j < count; j++) {
            sum += r.nextInt();
        }

        logger.info("MersenneRandom: {}ms.", (System.nanoTime() - start) / 1000000);
        logger.trace("Use the result so that JVM doesn't skip the computation - here it is: {}", sum);
    }
View Full Code Here

        MersenneRandom r = new MersenneRandom(new int[]{0x123, 0x234, 0x345, 0x456});
        logger.debug("Compare MersenneTwisterFast with new (2002/1/26) seeding mechanism with original result data..");

        for (int j = 0; j < 1000; j++) {
            // first, convert the int from signed to "unsigned"
            long l = r.nextInt();
            if (l < 0) {
                l += 4294967296L; // Integer.MAX_VALUE
            }

            assertEquals(FIRST_1000_VALS[j], l);
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.