Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 489 for random (0.2 sec)

  1. guava-tests/test/com/google/common/math/MathBenchmarking.java

       * result is chosen from those possibilities uniformly at random.
       *
       * <p>Zero is treated as having log2 == 0.
       */
      static double randomDouble(int maxExponent) {
        double result = RANDOM_SOURCE.nextDouble();
        result = Math.scalb(result, RANDOM_SOURCE.nextInt(maxExponent + 1));
        return RANDOM_SOURCE.nextBoolean() ? result : -result;
      }
    
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Mon Dec 04 17:37:03 GMT 2017
    - 4.1K bytes
    - Viewed (0)
  2. cmd/benchmark-utils_test.go

    }
    
    // randomly picks a character and returns its equivalent byte array.
    func getRandomByte() []byte {
    	const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
    	// seeding the random number generator.
    	rand.Seed(UTCNow().UnixNano())
    	// pick a character randomly.
    	return []byte{letterBytes[rand.Intn(len(letterBytes))]}
    }
    
    // picks a random byte and repeats it to size bytes.
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Fri Dec 23 15:46:00 GMT 2022
    - 8.2K bytes
    - Viewed (0)
  3. android/guava-tests/benchmark/com/google/common/collect/MinMaxPriorityQueueBenchmark.java

      private Queue<Integer> queue;
    
      private final Random random = new Random();
    
      @BeforeExperiment
      void setUp() {
        queue = heap.create(comparator.get());
        for (int i = 0; i < size; i++) {
          queue.add(random.nextInt());
        }
      }
    
      @Benchmark
      void pollAndAdd(int reps) {
        for (int i = 0; i < reps; i++) {
          // TODO(kevinb): precompute random #s?
          queue.add(queue.poll() ^ random.nextInt());
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Wed Apr 19 19:24:36 GMT 2023
    - 4.3K bytes
    - Viewed (0)
  4. guava-tests/test/com/google/common/hash/AbstractStreamingHasherTest.java

        sink.assertBytes(new byte[] {1, 2, 0, 0}); // padded with zeros
      }
    
      public void testString() {
        Random random = new Random();
        for (int i = 0; i < 100; i++) {
          byte[] bytes = new byte[64];
          random.nextBytes(bytes);
          String s = new String(bytes, UTF_16LE); // so all random strings are valid
          assertEquals(
              new Sink(4).putUnencodedChars(s).hash(),
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Wed Sep 06 17:04:31 GMT 2023
    - 8.5K bytes
    - Viewed (0)
  5. guava-tests/benchmark/com/google/common/collect/ConcurrentHashMultisetBenchmark.java

          total += future.get();
        }
        return total;
      }
    
      private long runAddSingleThread(int reps) {
        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;
      }
    
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Wed May 09 15:17:25 GMT 2018
    - 16.6K bytes
    - Viewed (0)
  6. guava-tests/test/com/google/common/hash/AbstractNonStreamingHashFunctionTest.java

                new StreamingVersion().newHasher(52),
                new NonStreamingVersion().newHasher(),
                new NonStreamingVersion().newHasher(123));
        Random random = new Random(0);
        for (int i = 0; i < 200; i++) {
          RandomHasherAction.pickAtRandom(random).performAction(random, hashers);
        }
        HashCode[] codes = new HashCode[hashers.size()];
        for (int i = 0; i < hashers.size(); i++) {
          codes[i] = hashers.get(i).hash();
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Mon Dec 04 17:37:03 GMT 2017
    - 4.4K bytes
    - Viewed (0)
  7. android/guava-tests/test/com/google/common/hash/AbstractNonStreamingHashFunctionTest.java

                new StreamingVersion().newHasher(52),
                new NonStreamingVersion().newHasher(),
                new NonStreamingVersion().newHasher(123));
        Random random = new Random(0);
        for (int i = 0; i < 200; i++) {
          RandomHasherAction.pickAtRandom(random).performAction(random, hashers);
        }
        HashCode[] codes = new HashCode[hashers.size()];
        for (int i = 0; i < hashers.size(); i++) {
          codes[i] = hashers.get(i).hash();
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Mon Dec 04 17:37:03 GMT 2017
    - 4.4K bytes
    - Viewed (0)
  8. android/guava-tests/benchmark/com/google/common/math/LessThanBenchmark.java

      @BeforeExperiment
      void setUp() {
        Random random = new Random(randomSeed);
        xInts = new int[SAMPLE_SIZE];
        yInts = new int[SAMPLE_SIZE];
        xLongs = new long[SAMPLE_SIZE];
        yLongs = new long[SAMPLE_SIZE];
        constant = new int[SAMPLE_SIZE];
        for (int i = 0; i < SAMPLE_SIZE; i++) {
          xInts[i] = random.nextInt(Integer.MAX_VALUE);
          yInts[i] = random.nextInt(Integer.MAX_VALUE);
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Mon Dec 04 17:37:03 GMT 2017
    - 4K bytes
    - Viewed (0)
  9. android/guava-tests/test/com/google/common/collect/MinMaxPriorityQueueTest.java

        long seed = new Random().nextLong();
        Random random = new Random(seed);
        insertRandomly(elements, q, random);
        return seed;
      }
    
      private static void insertRandomly(
          ArrayList<Integer> elements, MinMaxPriorityQueue<Integer> q, Random random) {
        while (!elements.isEmpty()) {
          int selectedIndex = random.nextInt(elements.size());
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Thu Mar 07 18:34:03 GMT 2024
    - 36.1K bytes
    - Viewed (0)
  10. android/guava/src/com/google/common/cache/Striped64.java

       * class-unloading when ThreadLocals are not removed.
       */
      static final ThreadLocal<int @Nullable []> threadHashCode = new ThreadLocal<>();
    
      /** Generator of new random hash codes */
      static final Random rng = new Random();
    
      /** Number of CPUS, to place bound on table size */
      static final int NCPU = Runtime.getRuntime().availableProcessors();
    
      /** Table of cells. When non-null, size is a power of 2. */
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Thu Feb 22 17:40:56 GMT 2024
    - 11.5K bytes
    - Viewed (0)
Back to top