Package java.util

Examples of java.util.Random.nextLong()


        LongHash<Long> hash = new LongHash<Long>();
        Random random = new Random(System.currentTimeMillis());
        for(int i = 0; i < 100000; i++) {
            int key = random.nextInt();
            keys[i] = key;
            long value = random.nextLong();
            hash.put(key, value);
        }
        LongHash<Long> copyed = ObjectUtils.deepCopy(hash);
        assert (hash.size() == copyed.size());
        for(int i = 0; i < 100000; i++) {
View Full Code Here


    public void testIterator() {
        long[] values = new long[100000];
        LongHash<Long> hash = new LongHash<Long>();
        Random random = new Random(System.currentTimeMillis());
        for(int i = 0; i < 100000; i++) {
            long v = random.nextLong();
            values[i] = v;
            hash.put(i, v);
        }

        long[] nvalues = new long[100000];
View Full Code Here

  {
    Random random = new Random(0L);

    byte[] data = new byte[8];
    for (int i = 0; i < valueCount; i++) {
      ByteArrayUtil.putLong(random.nextLong(), data, 0);
      btree.insert(data);
    }
  }

  private void update(long startValue, long increment, int valueCount, long updateDelta)
View Full Code Here

  testLong(1);
  testLong(Long.MIN_VALUE);
  testLong(Long.MAX_VALUE);
  Random rand = new Random();
  for (int i = 0; i < 1000; i++) {
      testLong(rand.nextLong());
  }
    }

    public void testLong(long v) throws Exception {
    }
View Full Code Here

  testLongArray(new long[] { Long.MAX_VALUE });
  testLongArray(new long[] { Long.MIN_VALUE, Long.MAX_VALUE });
  Random rand = new Random();
  long[] v = new long[100];
  for (int i = 0; i < v.length; ++i) {
      v[i] = rand.nextLong();
  }
  testLongArray(v);
    }

    public void testLongArray(long[] v) throws Exception {
View Full Code Here

  testBigInteger(BigInteger.valueOf(Long.MAX_VALUE));
  BigInteger max = BigInteger.valueOf(Long.MAX_VALUE).setBit(63);
  testBigInteger(max);
  Random rand = new Random();
  for (int i = 0; i < 1000; i++) {
      testBigInteger(max.subtract(BigInteger.valueOf(Math.abs(rand.nextLong()))));
  }
    }

    public void testBigInteger(BigInteger v) throws Exception {
    }
View Full Code Here

    private Set<Long> generate() {
        Set<Long> set = new HashSet<Long>();
        Random r = new Random();
        for (int i = 0; i < 2000; ++i)
            set.add(r.nextLong());
        return set;
    }

    private LongHashSet createFromJavaSet() {
        LongHashSet set = new LongHashSet();
View Full Code Here

        drecv = new double[length];

        for (int i = 0; i < length; ++i) {
            dsend[i] = r.nextDouble();
            fsend[i] = r.nextFloat();
            lsend[i] = r.nextLong();
            isend[i] = r.nextInt();
            ssend[i] = (short) r.nextInt();
            csend[i] = (char) r.nextInt();
            bsend[i] = (byte) r.nextInt();
        }
View Full Code Here

        // create threads
        Random random = new Random(initialSeed);
        for (int i = 0; i < bits; i++)
        {
            final int thisindex = i;
            long nextSeed = random.nextLong();
            randoms[i] = new Random(nextSeed);
            threads[i] = new Thread()
            {
                public void run()
                {
View Full Code Here

        return false;
    }

    public String getCookie(final Entry entry){
        final Random r = new Random();
        final String token = Long.toString(Math.abs(r.nextLong()), 36);
        cookieUsers.put(token, entry);
        return token;
    }

    public String getAdminCookie(){
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.