Examples of Random


Examples of java.util.Random

        // 9 hours per day
        settings.setTimeslotsPerDay(9);

        ncpInstance = new NoCollisionPrinciple();
        ncpInstance.setCondition(new AlgorithmConditionIteration(10000));
        ncpInstance.setRandom(new Random(123456L));
        ncpInstance.setDataPoolSettings(settings);
        ncpInstance.setStatusBar(new SilentConsoleStatusBar());
    }
View Full Code Here

Examples of java.util.Random

        settings.setNumberOfDays(5);
        // 9 hours per day
        settings.setTimeslotsPerDay(9);

        NoCollisionPrinciple ncpInstance = new NoCollisionPrinciple();
        ncpInstance.setRandom(new Random(seed));//123456L
        ncpInstance.setCondition(new AlgorithmConditionTime(seconds));
        ncpInstance.setDataPoolSettings(settings);
        ncpInstance.setStatusBar(new SilentConsoleStatusBar());
        ncpInstance.setDataPool(dataPool);
View Full Code Here

Examples of java.util.Random

        ImportBTXml.overwriteSettings(settings);
        importer.setDataPoolSettings(settings);       
        importer.doWork();

        NoCollisionPrinciple ncpInstance = new NoCollisionPrinciple();
        ncpInstance.setRandom(new Random(123456L));
        ncpInstance.setCondition(new AlgorithmConditionIteration(5));
        ncpInstance.setDataPoolSettings(settings);
        ncpInstance.setStatusBar(new SilentConsoleStatusBar());
        ncpInstance.setDataPool(dataPool);
View Full Code Here

Examples of java.util.Random

            }
        }
        printTimeMemory("select", System.currentTimeMillis() - time);

        // select randomized
        Random random = new Random(1);
        time = System.currentTimeMillis();
        prep = conn.prepareStatement("SELECT * FROM TEST WHERE ID = ?");
        for (int i = 0; i < len; i++) {
            prep.setInt(1, random.nextInt(len));
            ResultSet rs = prep.executeQuery();
            rs.next();
            assertFalse(rs.next());
            if (i % 50000 == 0) {
                trace("  " + (100 * i / len) + "%");
            }
        }
        printTimeMemory("select randomized", System.currentTimeMillis() - time);

        // delete
        time = System.currentTimeMillis();
        prep = conn.prepareStatement("DELETE FROM TEST WHERE ID = ?");
        for (int i = 0; i < len; i++) {
            prep.setInt(1, random.nextInt(len));
            prep.executeUpdate();
            if (i % 50000 == 0) {
                trace("  " + (100 * i / len) + "%");
            }
        }
View Full Code Here

Examples of java.util.Random

public String title, company, location, description;
public Calendar post_date;
public boolean visible;

public static Iterator jobs() {
    Random rand = new Random();
    ArrayList jobs = new ArrayList();
    for (int i = 0; i < NUM_JOBS; ++i)
  jobs.add(new Job(rand, i));
    return jobs.iterator();
}
View Full Code Here

Examples of java.util.Random

        conn.setAutoCommit(false);
        int[] count = new int[2];
        int[] countCommitted = new int[2];
        int[] countSave = new int[2];
        int len = getSize(2000, 10000);
        Random random = new Random(10);
        Savepoint sp = null;
        for (int i = 0; i < len; i++) {
            int tableId = random.nextInt(2);
            String table = "TEST" + tableId;
            int op = random.nextInt(6);
            switch (op) {
            case 0:
                stat.execute("INSERT INTO " + table + "(NAME) VALUES('op" + i + "')");
                count[tableId]++;
                break;
View Full Code Here

Examples of java.util.Random

        BitField field = new BitField();
        set.set(0, 640);
        field.set(0, 640, true);
        assertEquals(set.nextClearBit(0), field.nextClearBit(0));

        Random random = new Random(1);
        field = new BitField();
        field.set(0, 500, true);
        for (int i = 0; i < 100000; i++) {
            int a = random.nextInt(120);
            int b = a + 1 + random.nextInt(200);
            field.clear(a);
            field.clear(b);
            assertEquals(b, field.nextClearBit(a + 1));
            field.set(a);
            field.set(b);
View Full Code Here

Examples of java.util.Random

        testSetFast(used, true);
    }

    private void testSetFast(BitField used, boolean init) {
        int len = 10000;
        Random random = new Random(1);
        for (int i = 0, x = 0; i < len / 8; i++) {
            int mask = random.nextInt() & 255;
            if (init) {
                assertEquals(mask, used.getByte(x));
                x += 8;
                // for (int j = 0; j < 8; j++, x++) {
                // if (used.get(x) != ((mask & (1 << j)) != 0)) {
View Full Code Here

Examples of java.util.Random

    private void testRandom() {
        BitField bits = new BitField();
        BitSet set = new BitSet();
        int max = 300;
        int count = 100000;
        Random random = new Random(1);
        for (int i = 0; i < count; i++) {
            int idx = random.nextInt(max);
            if (random.nextBoolean()) {
                if (random.nextBoolean()) {
                    bits.set(idx);
                    set.set(idx);
                } else {
                    bits.clear(idx);
                    set.clear(idx);
View Full Code Here

Examples of java.util.Random

    }

    private void testRandomSetRange() {
        BitField bits = new BitField();
        BitSet set = new BitSet();
        Random random = new Random(1);
        int maxOffset = 500;
        int maxLen = 500;
        int total = maxOffset + maxLen;
        int count = 10000;
        for (int i = 0; i < count; i++) {
            int offset = random.nextInt(maxOffset);
            int len = random.nextInt(maxLen);
            boolean val = random.nextBoolean();
            set.set(offset, offset + len, val);
            bits.set(offset, offset + len, val);
            for (int j = 0; j < total; j++) {
                assertEquals(set.get(j), bits.get(j));
            }
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.