Search Options

Results per page
Sort
Preferred Languages
Advance

Results 51 - 60 of 139 for nextInt (2.82 sec)

  1. guava-tests/test/com/google/common/io/RandomAmountInputStream.java

        super(checkNotNull(in));
        this.random = checkNotNull(random);
      }
    
      @Override
      public int read(byte[] b, int off, int len) throws IOException {
        return super.read(b, off, random.nextInt(len) + 1);
      }
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Mon Dec 04 17:37:03 GMT 2017
    - 1.2K bytes
    - Viewed (0)
  2. android/guava-tests/benchmark/com/google/common/collect/ConcurrentHashMultisetBenchmark.java

        Random random = new Random();
        int nKeys = keys.size();
        long blah = 0;
        for (int i = 0; i < reps; i++) {
          Integer key = keys.get(random.nextInt(nKeys));
          int delta = random.nextInt(5);
          blah += delta;
          multiset.add(key, delta);
        }
        return blah;
      }
    
      private long runAddRemoveSingleThread(int reps) {
        Random random = new Random();
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Thu Apr 06 12:56:11 GMT 2023
    - 16.6K bytes
    - Viewed (0)
  3. android/guava-tests/benchmark/com/google/common/collect/ComparatorDelegationOverheadBenchmark.java

      @BeforeExperiment
      void setUp() throws Exception {
        Random rng = new Random();
        for (int i = 0; i < 0x100; i++) {
          Integer[] array = new Integer[n];
          for (int j = 0; j < n; j++) {
            array[j] = rng.nextInt();
          }
          inputArrays[i] = array;
        }
      }
    
      @Benchmark
      int arraysSortNoComparator(int reps) {
        int tmp = 0;
        for (int i = 0; i < reps; i++) {
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Mon Dec 04 17:37:03 GMT 2017
    - 2.5K bytes
    - Viewed (0)
  4. guava-tests/benchmark/com/google/common/collect/HashMultisetAddPresentBenchmark.java

        multisets.clear();
        for (int i = 0; i < ARRAY_SIZE; i++) {
          HashMultiset<Integer> multiset = HashMultiset.<Integer>create();
          multisets.add(multiset);
          queries[i] = random.nextInt();
          multiset.add(queries[i]);
        }
      }
    
      @Benchmark
      int add(int reps) {
        int tmp = 0;
        for (int i = 0; i < reps; i++) {
          int j = i & ARRAY_MASK;
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Mon Dec 04 17:37:03 GMT 2017
    - 1.6K bytes
    - Viewed (0)
  5. guava-tests/test/com/google/common/hash/BloomFilterTest.java

          new ThreadLocal<Random>() {
            @Override
            protected Random initialValue() {
              return new Random();
            }
          };
    
      private static final int GOLDEN_PRESENT_KEY = random.get().nextInt();
    
      @AndroidIncompatible // OutOfMemoryError
      public void testLargeBloomFilterDoesntOverflow() {
        long numBits = Integer.MAX_VALUE;
        numBits++;
    
        LockFreeBitArray bitArray = new LockFreeBitArray(numBits);
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Thu Nov 09 22:49:56 GMT 2023
    - 21.3K bytes
    - Viewed (0)
  6. guava-tests/test/com/google/common/primitives/UnsignedBytesTest.java

          for (int trials = 10; trials-- > 0; ) {
            byte[] left = new byte[1 + rnd.nextInt(32)];
            rnd.nextBytes(left);
            byte[] right = left.clone();
            assertThat(comparator.compare(left, right)).isEqualTo(0);
            int i = rnd.nextInt(left.length);
            left[i] ^= (byte) (1 + rnd.nextInt(255));
            assertThat(comparator.compare(left, right)).isNotEqualTo(0);
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Tue Feb 20 17:00:05 GMT 2024
    - 13.4K bytes
    - Viewed (0)
  7. android/guava-tests/benchmark/com/google/common/math/IntMathRoundingBenchmark.java

        for (int i = 0; i < ARRAY_SIZE; i++) {
          positive[i] = randomPositiveBigInteger(Integer.SIZE - 2).intValue();
          nonzero[i] = randomNonZeroBigInteger(Integer.SIZE - 2).intValue();
          ints[i] = RANDOM_SOURCE.nextInt();
        }
      }
    
      @Param({"DOWN", "UP", "FLOOR", "CEILING", "HALF_EVEN", "HALF_UP", "HALF_DOWN"})
      RoundingMode mode;
    
      @Benchmark
      int log2(int reps) {
        int tmp = 0;
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Mon Dec 04 17:37:03 GMT 2017
    - 2.6K bytes
    - Viewed (0)
  8. guava-tests/test/com/google/common/io/ByteSourceTester.java

          // if expected.length == 0, off has to be 0 but length doesn't matter--result will be empty
          int off = expected.length == 0 ? 0 : random.nextInt(expected.length);
          int len = expected.length == 0 ? 4 : random.nextInt(expected.length - off);
    
          ByteSourceFactory sliced = SourceSinkFactories.asSlicedByteSourceFactory(factory, off, len);
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Wed Sep 06 17:04:31 GMT 2023
    - 8.6K bytes
    - Viewed (0)
  9. android/guava-tests/benchmark/com/google/common/math/DoubleMathBenchmark.java

      @BeforeExperiment
      void setUp() {
        for (int i = 0; i < ARRAY_SIZE; i++) {
          positiveDoubles[i] = randomPositiveDouble();
          doubles[i] = randomDouble(Long.SIZE);
          factorials[i] = RANDOM_SOURCE.nextInt(100);
        }
      }
    
      @Benchmark
      long log2(int reps) {
        long tmp = 0;
        for (int i = 0; i < reps; i++) {
          int j = i & ARRAY_MASK;
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Mon Dec 04 17:37:03 GMT 2017
    - 2.5K bytes
    - Viewed (0)
  10. android/guava-tests/test/com/google/common/io/RandomAmountInputStream.java

        super(checkNotNull(in));
        this.random = checkNotNull(random);
      }
    
      @Override
      public int read(byte[] b, int off, int len) throws IOException {
        return super.read(b, off, random.nextInt(len) + 1);
      }
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Mon Dec 04 17:37:03 GMT 2017
    - 1.2K bytes
    - Viewed (0)
Back to top