belliottsmith commented on code in PR #4251:
URL: https://github.com/apache/cassandra/pull/4251#discussion_r2206829451


##########
test/unit/org/apache/cassandra/utils/btree/IntervalBTreeTest.java:
##########
@@ -268,7 +463,7 @@ private static void remove(Object[] tree, 
TreeSet<TestInterval> removeFrom, Test
 
     private static TestInterval newInterval(RandomSource random, int 
keyDomain, int valueDomain)
     {
-        int end = 1 + random.nextInt(keyDomain - 1);
+        int end = 1 + random.nextInt(Math.max(1, keyDomain - 1));

Review Comment:
   maybe just `end = keyDomain == 1 ? 1 : 1 + random.nextInt(Math.max(1, 
keyDomain - 1))` ?



##########
test/unit/org/apache/cassandra/utils/btree/IntervalBTreeTest.java:
##########
@@ -268,7 +463,7 @@ private static void remove(Object[] tree, 
TreeSet<TestInterval> removeFrom, Test
 
     private static TestInterval newInterval(RandomSource random, int 
keyDomain, int valueDomain)
     {
-        int end = 1 + random.nextInt(keyDomain - 1);
+        int end = 1 + random.nextInt(Math.max(1, keyDomain - 1));

Review Comment:
   maybe `end = keyDomain == 1 ? 1 : 1 + random.nextInt(Math.max(1, keyDomain - 
1))` ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to