Repository: commons-rng
Updated Branches:
  refs/heads/master c5a185866 -> b47d92338


Clear CheckStyle report (web site).


Project: http://git-wip-us.apache.org/repos/asf/commons-rng/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rng/commit/311b5ec1
Tree: http://git-wip-us.apache.org/repos/asf/commons-rng/tree/311b5ec1
Diff: http://git-wip-us.apache.org/repos/asf/commons-rng/diff/311b5ec1

Branch: refs/heads/master
Commit: 311b5ec190635951014816070a11ade93d27be8b
Parents: c5a1858
Author: Gilles <er...@apache.org>
Authored: Tue Nov 22 15:10:30 2016 +0100
Committer: Gilles <er...@apache.org>
Committed: Tue Nov 22 15:10:30 2016 +0100

----------------------------------------------------------------------
 .../commons/rng/jmh/GenerationPerformance.java  | 63 ++++++++++++++++----
 1 file changed, 52 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-rng/blob/311b5ec1/commons-rng-jmh/src/main/java/org/apache/commons/rng/jmh/GenerationPerformance.java
----------------------------------------------------------------------
diff --git 
a/commons-rng-jmh/src/main/java/org/apache/commons/rng/jmh/GenerationPerformance.java
 
b/commons-rng-jmh/src/main/java/org/apache/commons/rng/jmh/GenerationPerformance.java
index d53c5e0..b1b663b 100644
--- 
a/commons-rng-jmh/src/main/java/org/apache/commons/rng/jmh/GenerationPerformance.java
+++ 
b/commons-rng-jmh/src/main/java/org/apache/commons/rng/jmh/GenerationPerformance.java
@@ -68,10 +68,19 @@ public class GenerationPerformance {
                 "XOR_SHIFT_1024_S",
                 "TWO_CMRES",
                 "MT_64" })
-        String randomSourceName;
+        private String randomSourceName;
 
-        UniformRandomProvider provider;
+        /** RNG. */
+        private UniformRandomProvider provider;
 
+        /**
+         * @return the RNG.
+         */
+        public UniformRandomProvider getGenerator() {
+            return provider;
+        }
+
+        /** Intantiates generator. */
         @Setup
         public void setup() {
             final RandomSource randomSource = 
RandomSource.valueOf(randomSourceName);
@@ -83,71 +92,103 @@ public class GenerationPerformance {
      * Number of random values to generate.
      */
     @Param({"1", "100", "10000", "1000000"})
-    int numValues;
+    private int numValues;
 
+    /**
+     * @param sources Source of randomness.
+     * @param bh Data sink.
+     */
     @Benchmark
     public void nextBoolean(Sources sources,
                             Blackhole bh) {
         for (int i = 0; i < numValues; i++) {
-            bh.consume(sources.provider.nextBoolean());
+            bh.consume(sources.getGenerator().nextBoolean());
         }
     }
 
+    /**
+     * @param sources Source of randomness.
+     * @param bh Data sink.
+     */
     @Benchmark
     public void nextInt(Sources sources,
                         Blackhole bh) {
         for (int i = 0; i < numValues; i++) {
-            bh.consume(sources.provider.nextInt());
+            bh.consume(sources.getGenerator().nextInt());
         }
     }
 
+    /**
+     * @param sources Source of randomness.
+     * @param bh Data sink.
+     */
     @Benchmark
     public void nextIntN(Sources sources,
                          Blackhole bh) {
         final int n = 10;
         for (int i = 0; i < numValues; i++) {
-            bh.consume(sources.provider.nextInt(n));
+            bh.consume(sources.getGenerator().nextInt(n));
         }
     }
 
+    /**
+     * @param sources Source of randomness.
+     * @param bh Data sink.
+     */
     @Benchmark
     public void nextLong(Sources sources,
                          Blackhole bh) {
         for (int i = 0; i < numValues; i++) {
-            bh.consume(sources.provider.nextLong());
+            bh.consume(sources.getGenerator().nextLong());
         }
     }
 
+    /**
+     * @param sources Source of randomness.
+     * @param bh Data sink.
+     */
     @Benchmark
     public void nextLongN(Sources sources,
                           Blackhole bh) {
         final long n = 2L * Integer.MAX_VALUE;
         for (int i = 0; i < numValues; i++) {
-            bh.consume(sources.provider.nextLong(n));
+            bh.consume(sources.getGenerator().nextLong(n));
         }
     }
 
+    /**
+     * @param sources Source of randomness.
+     * @param bh Data sink.
+     */
     @Benchmark
     public void nextFloat(Sources sources,
                           Blackhole bh) {
         for (int i = 0; i < numValues; i++) {
-            bh.consume(sources.provider.nextFloat());
+            bh.consume(sources.getGenerator().nextFloat());
         }
     }
 
+    /**
+     * @param sources Source of randomness.
+     * @param bh Data sink.
+     */
     @Benchmark
     public void nextDouble(Sources sources,
                            Blackhole bh) {
         for (int i = 0; i < numValues; i++) {
-            bh.consume(sources.provider.nextDouble());
+            bh.consume(sources.getGenerator().nextDouble());
         }
     }
 
+    /**
+     * @param sources Source of randomness.
+     * @param bh Data sink.
+     */
     @Benchmark
     public void nextBytes(Sources sources,
                           Blackhole bh) {
         final byte[] result = new byte[numValues];
-        sources.provider.nextBytes(result);
+        sources.getGenerator().nextBytes(result);
         bh.consume(result);
     }
 }

Reply via email to