Package java.util

Examples of java.util.Random.nextLong()


    public synchronized static boolean acquireLock(FileSystemManager fsManager, FileObject fo) {
       
        // generate a random lock value to ensure that there are no two parties
        // processing the same file
        Random random = new Random();
        byte[] lockValue = String.valueOf(random.nextLong()).getBytes();
       
        try {
            // check whether there is an existing lock for this item, if so it is assumed
            // to be processed by an another listener (downloading) or a sender (uploading)
            // lock file is derived by attaching the ".lock" second extension to the file name
View Full Code Here


        ConcurrentPluggableCache<Long, Long> cache = new ConcurrentPluggableCache<Long, Long>(capacity);
        cache.setReplacementPolicy(ReplacementPolicySelector.<Long, Long> provide(capacity, algo));
        Random rand = new Random(76675734342L);
        StopWatch watchdog = new StopWatch("capacity: " + capacity + ", round: " + round);
        for(int i = 0; i < round; i++) {
            long key = Math.abs(rand.nextLong()) % round;
            ICacheEntry<Long, Long> entry = cache.allocateEntry(key);
            entry.setValue(key);
            entry.unpin();
        }
        System.err.println(watchdog.toString());
View Full Code Here

        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

        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

        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

        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

        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

        String[] values = new String[] { null, "0", "0", "1", "2", "10", "a", "?" };
        String[] compares = new String[] { "in(", "not in(", "=", "=", ">",
                "<", ">=", "<=", "<>", "in(select", "not in(select" };
        int size = getSize(100, 1000);
        for (int i = 0; i < size; i++) {
            long seed = seedGenerator.nextLong();
            println("seed: " + seed);
            Random random = new Random(seed);
            ArrayList<String> params = New.arrayList();
            String condition = getRandomCondition(random, params, columns, compares, values);
            //   System.out.println(condition + " " + params);
View Full Code Here

        db.execute("CREATE INDEX IDX ON TEST(A)");
        db.execute("INSERT INTO TEST SELECT X/4, MOD(X, 4) FROM SYSTEM_RANGE(1, 16)");
        db.execute("UPDATE TEST SET A = NULL WHERE A = 0");
        db.execute("UPDATE TEST SET B = NULL WHERE B = 0");
        Random random = new Random();
        long seed = random.nextLong();
        println("seed: " + seed);
        for (int i = 0; i < 100; i++) {
            String column = random.nextBoolean() ? "A" : "B";
            String value = new String[] { "NULL", "0", "A", "B" }[random.nextInt(4)];
            String compare = random.nextBoolean() ? "A" : "B";
View Full Code Here

    private void testGroupSorted() {
        Db db = new Db(conn);
        db.execute("CREATE TABLE TEST(A INT, B INT, C INT)");
        Random random = new Random();
        long seed = random.nextLong();
        println("seed: " + seed);
        for (int i = 0; i < 100; i++) {
            Prepared p = db.prepare("INSERT INTO TEST VALUES(?, ?, ?)");
            p.set(new String[] { null, "0", "1", "2" }[random.nextInt(4)]);
            p.set(new String[] { null, "0", "1", "2" }[random.nextInt(4)]);
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.