Examples of nextLong()


Examples of java.util.Random.nextLong()

  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

Examples of java.util.Random.nextLong()

  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

Examples of java.util.Random.nextLong()

    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

Examples of java.util.Random.nextLong()

        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

Examples of java.util.Random.nextLong()

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

Examples of java.util.Random.nextLong()

        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

Examples of java.util.Random.nextLong()

        return token;
    }

    public String getAdminCookie(){
        final Random r = new Random();
        final String token = Long.toString(Math.abs(r.nextLong()), 36);
        cookieUsers.put(token, "admin");
        return token;
    }
   
    public static String getLoginToken(final String cookies){
View Full Code Here

Examples of java.util.Random.nextLong()

        for (int i = 0; i < tablefile.length; i++) {
            if ((tablefile[i].startsWith(prefix)) &&
                (tablefile[i].charAt(prefix.length()) == '.') &&
                (tablefile[i].length() == prefix.length() + 7)) {
                f = new File(path, tablefile[i]);
                String newname = tablefile[i] + "0100000" + (Long.toString(r.nextLong())+"00000").substring(1,5) + ".table";
                f.renameTo(new File(path, newname));
            }
        }
        // read new list again
        tablefile = path.list();
View Full Code Here

Examples of java.util.Random.nextLong()

    }
  }
 
  private String createRandomString() {
    Random random = new Random(System.currentTimeMillis());
    long randomLong = random.nextLong();
    return Long.toHexString(randomLong);
  }

  /**
   * Returns the queryCount number for this cluster node.
View Full Code Here

Examples of java.util.Random.nextLong()

    private long[] longArray(int count)
    {
        Random r = new Random(count);
        long[] result = new long[count];
        for (int i = 0; i < count; ++i) {
            long base = r.nextLong();
            int shift = (r.nextInt() % 56);
            result[i] = (base >> shift);
        }
        return result;
    }
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.