@@ -0,0 +1,1772 @@
+package biz.k11i.rng;%0A%0Aimport org.openjdk.jmh.annotations.Benchmark;%0Aimport org.openjdk.jmh.annotations.Param;%0Aimport org.openjdk.jmh.annotations.Scope;%0Aimport org.openjdk.jmh.annotations.Setup;%0Aimport org.openjdk.jmh.annotations.State;%0A%0Aimport java.util.SplittableRandom;%0Aimport java.util.concurrent.ThreadLocalRandom;%0Aimport java.util.stream.IntStream;%0A%0Apublic class NextIntWithBoundBenchmark %7B%0A    @State(Scope.Benchmark)%0A    public static class FixedBound %7B%0A        @Param(%7B%221025%22, // 2%5E10 + 1%0A                %221048577%22, // 2%5E20 + 1%0A                %221073741828%22, // 2%5E30 + 4%0A        %7D)%0A        private int bound;%0A%0A        @Benchmark%0A        public int jdk() %7B%0A            return ThreadLocalRandom.current().nextInt(bound);%0A        %7D%0A%0A        @Benchmark%0A        public int nearlyDivisionless() %7B%0A            return UniformRNGUtils.nextInt(ThreadLocalRandom.current(), bound);%0A        %7D%0A    %7D%0A%0A    @State(Scope.Benchmark)%0A    public static class ArbitraryBounds %7B%0A        private static final int NUM_BOUNDS = 1 %3C%3C 10;%0A        private int%5B%5D bounds;%0A        private int index;%0A%0A        @Setup%0A        public void setUp() %7B%0A            SplittableRandom r = new SplittableRandom(12345);%0A            bounds = IntStream%0A                    .generate(() -%3E r.nextInt(Integer.MAX_VALUE - 1) + 1)%0A                    .limit(NUM_BOUNDS)%0A                    .toArray();%0A        %7D%0A%0A        @Benchmark%0A        public int jdk() %7B%0A            index = (index + 1) & (NUM_BOUNDS - 1);%0A            return ThreadLocalRandom.current().nextInt(bounds%5Bindex%5D);%0A        %7D%0A%0A        @Benchmark%0A        public int nearlyDivisionless() %7B%0A            index = (index + 1) & (NUM_BOUNDS - 1);%0A            return UniformRNGUtils.nextInt(ThreadLocalRandom.current(), bounds%5Bindex%5D);%0A        %7D%0A    %7D%0A%7D%0A

Add benchmark