MCPcopy Create free account
hub / github.com/apache/solr / randomSets

Method randomSets

solr/core/src/test/org/apache/solr/util/BitSetPerf.java:33–45  ·  view source on GitHub ↗
(int maxSize, int bitsToSet, BitSet target1, FixedBitSet target2)

Source from the content-addressed store, hash-verified

31 static Random rand = new Random(0);
32
33 static void randomSets(int maxSize, int bitsToSet, BitSet target1, FixedBitSet target2) {
34 for (int i = 0; i < bitsToSet; i++) {
35 int idx;
36 do {
37 idx = rand.nextInt(maxSize);
38 } while (target2.getAndSet(idx));
39 target1.set(idx);
40 }
41 /*
42 int i=target1.cardinality();
43 if (i!=bitsToSet || i!=target2.cardinality()) throw new RuntimeException();
44 */
45 }
46
47 public static void main(String[] args) {
48 if (args.length < 5) {

Callers 1

mainMethod · 0.95

Calls 2

nextIntMethod · 0.80
setMethod · 0.65

Tested by

no test coverage detected