Skip to content

Commit d01199d

Browse files
committed
Add RandomChoices with rarely().
1 parent 659397d commit d01199d

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

  • randomizedtesting-jupiter/src/main/java/com/carrotsearch/randomizedtesting/jupiter/generators
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.carrotsearch.randomizedtesting.jupiter.generators;
2+
3+
import java.util.Random;
4+
5+
/** Random selections of objects. */
6+
public final class RandomChoices {
7+
/** Returns {@code true} rarely (~10% of calls). */
8+
public static boolean rarely(Random r) {
9+
return r.nextInt(100) >= 90;
10+
}
11+
}

0 commit comments

Comments
 (0)