Examples of Random


Examples of java.util.Random

        int buckets = Primes.findLeastPrimeNumber(3000);
        SortedStaticHash hash = new SortedStaticHash(tmpFile, 1024 * 2, buckets);
        hash.create(false);

        List<byte[]> list = new ArrayList<byte[]>(REPEAT);
        Random random = new Random(54552542345L);
        StopWatch sw1 = new StopWatch("[SortedStaticHash_with_" + buckets
                + "_buckets_2kPage] Index Construction of " + REPEAT);
        for(int i = 0; i < REPEAT; i++) {
            String d = Double.toString(random.nextLong());
            byte[] b = StringUtils.getBytes(d);
            Key k = new Key(b);
            Value v = new Value(b);
            Assert.assertNull(hash.addValue(k, v));
            list.add(b);
View Full Code Here

Examples of java.util.Random

        int buckets = Primes.findLeastPrimeNumber(REPEAT / 100);
        SortedStaticHash hash = new SortedStaticHash(tmpFile, buckets);
        hash.create(false);

        List<byte[]> list = new ArrayList<byte[]>(REPEAT);
        Random random = new Random(54552542345L);
        StopWatch sw1 = new StopWatch("[SortedStaticHash_with_" + buckets
                + "_buckets] Index Construction of " + REPEAT);
        for(int i = 0; i < REPEAT; i++) {
            String d = Double.toString(random.nextLong());
            byte[] b = StringUtils.getBytes(d);
            Key k = new Key(b);
            Value v = new Value(b);
            Assert.assertNull(hash.addValue(k, v));
            list.add(b);
View Full Code Here

Examples of java.util.Random

        tmpFile.deleteOnExit();
        BIndexFile bfile = new BIndexFile(tmpFile, false);
        bfile.create(false);

        List<byte[]> list = new ArrayList<byte[]>(REPEAT);
        Random random = new Random(54552542345L);
        StopWatch sw1 = new StopWatch("[BFileUniq] Index Construction of " + REPEAT);
        for(int i = 0; i < REPEAT; i++) {
            long v = random.nextLong();
            byte[] b = Primitives.toBytes(v);
            Value k = new Value(b);
            bfile.addValue(k, b);
            list.add(b);
        }
View Full Code Here

Examples of java.util.Random

            CvFile remoteFile = homeFile.create();
            remoteFile.setDataSource(dataSource);

            CvFolderVO homeFld = remoteFile.getHomeFolder(individualID);

            int rn = (new Random()).nextInt();
            Calendar c = Calendar.getInstance();
            java.util.Date dt = c.getTime();
            DateFormat df = new SimpleDateFormat("MM_dd_yyyy");
            String dateStamp = df.format(dt);
View Full Code Here

Examples of java.util.Random

        matrix.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, matrix);
        periode.setRandom(new Random());

        assertTrue(periode.add(b, 0));
        assertTrue(periode.add(c, 1));
        periode.add(a, -1);
        assertEquals(true, a.getStart() < 0);
View Full Code Here

Examples of java.util.Random

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

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

        assertTrue(periode.doMove(a, 0));
        assertEquals(0, a.getStart());
        assertEquals(loc, a.getLocation());
View Full Code Here

Examples of java.util.Random

        matrix.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, matrix);
        periode.setRandom(new Random());

        assertTrue(periode.add(b, 0));
        assertFalse(periode.add(c, 1));
        assertTrue(periode.add(c, 2));
        periode.add(a, -1);
View Full Code Here

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

Examples of java.util.Random

        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

Examples of java.util.Random

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