### Question:
FeeReceiverSelector { @VisibleForTesting static int weightedSelection(List<Long> weights, Random rnd) { long sum = weights.stream().mapToLong(n -> n).sum(); long target = rnd.longs(0, sum).findFirst().orElseThrow(); int i; for (i = 0; i < weights.size() && target >= 0; i++) { target -= weights.get(i); } return i - 1; }  static String getAddress(DaoFacade daoFacade, FilterManager filterManager);  }### Answer:
@Test public void testWeightedSelection() { Random rnd = new Random(456); int[] selections = new int[3]; for (int i = 0; i < 6000; i++) { selections[FeeReceiverSelector.weightedSelection(Longs.asList(1, 2, 3), rnd)]++; } assertEquals(1000.0, selections[0], 58); assertEquals(2000.0, selections[1], 74); assertEquals(3000.0, selections[2], 78); }