Package java.util

Examples of java.util.Random


    public CoarseCuckooHashSet(int capacity) {
        lock = new ReentrantLock();
        table = (T[][]) new Object[2][capacity];
        size = capacity;
        random = new Random();
    }
View Full Code Here


        tmpFile.deleteOnExit();
        BTree btree = new BTree(tmpFile, false);
        btree.create(false);

        List<byte[]> list = new ArrayList<byte[]>(REPEAT);
        Random random = new Random(54552542345L);
        StopWatch sw1 = new StopWatch("[BplusTreeUniq] 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);
            Assert.assertTrue(btree.addValue(k, v) == -1);
            list.add(b);
        }
View Full Code Here

        int buckets = Primes.findLeastPrimeNumber(3000);
        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

        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

        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

        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

            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

        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

        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

        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

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.