ndimiduk commented on code in PR #4954:
URL: https://github.com/apache/hbase/pull/4954#discussion_r1067043473


##########
hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/monkies/PolicyBasedChaosMonkey.java:
##########
@@ -116,13 +116,13 @@ public static <T> T selectWeightedRandomItem(List<Pair<T, 
Integer>> items) {
 
   /** Selects and returns ceil(ratio * items.length) random items from the 
given array */
   public static <T> List<T> selectRandomItems(T[] items, float ratio) {
-    int selectedNumber = (int) Math.ceil(items.length * ratio);
-
-    List<T> originalItems = Arrays.asList(items);
+    final int selectedNumber = (int) Math.ceil(items.length * ratio);
+    final List<T> originalItems = Arrays.asList(items);
     Collections.shuffle(originalItems);
-
-    int startIndex = ThreadLocalRandom.current().nextInt(items.length - 
selectedNumber);
-    return originalItems.subList(startIndex, startIndex + selectedNumber);
+    final int startIndex =

Review Comment:
   I think it's more likely that I have `ratio == length`, we'll have this 
problem... Let me add some debugging and see what I can learn.



-- 
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]

Reply via email to