Package java.util

Examples of java.util.Random


        conflictMatrix.initFromResources(newResources(Arrays.asList(a, b), Arrays.asList(a, c), Arrays.asList(b, c)));

        List locations = Arrays.asList(new Location(5));

        periode = newPeriod(slotsPerWeek, locations, conflictMatrix);
        periode.setRandom(new Random());

        // 'spread'
        assertTrue(periode.add(b, 0));
        periode.add(c, -1);
View Full Code Here


        final Location loc1 = new Location(5);
        final Location loc2 = new Location(10);
        List locations = Arrays.asList(loc1, loc2);

        periode = newPeriod(slotsPerWeek, locations, conflictMatrix);
        periode.setRandom(new Random());

        assertTrue(periode.add(a, 0));
        assertTrue(periode.add(b, 0));
        assertNotNull(a.getLocation());
        assertNotNull(b.getLocation());
View Full Code Here

        final Location loc2 = new Location(10);
        loc1.addFeature(loc1Feature);
        List locations = Arrays.asList(loc1, loc2);

        periode = newPeriod(slotsPerWeek, locations, conflictMatrix);
        periode.setRandom(new Random());

        assertEquals(true, periode.add(ass3, 2));
        assertEquals(true, periode.add(ass2, 1));
        assertEquals(loc2, ass3.getLocation());
        assertEquals(loc1, ass2.getLocation());
View Full Code Here

        // 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

        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

        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

            }
        }
        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

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

        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

        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

TOP

Related Classes of java.util.Random

Copyright © 2018 www.massapicom. 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.