Github user kinow commented on a diff in the pull request:

    https://github.com/apache/commons-rng/pull/5#discussion_r143630148
  
    --- Diff: 
commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/ZigguratGaussianSampler.java
 ---
    @@ -0,0 +1,152 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *      http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.commons.rng.sampling.distribution;
    +
    +import org.apache.commons.rng.UniformRandomProvider;
    +
    +/**
    + * Gaussian Sampling by
    + * <a href="https://en.wikipedia.org/wiki/Ziggurat_algorithm";>Ziggurat 
algorithm</a>
    + *
    + * <p>Based on
    + * "The Ziggurat Method for Generating Random Variables"<br>
    + * by George Marsaglia and Wai Wan Tsang</p>
    + *
    + * @see <a 
href="http://www.jstatsoft.org/article/view/v005i08/ziggurat.pdf";>Ziggurat 
Method for Generating Random Variables</a>
    + *
    + * @since 1.1
    + */
    +
    +public class ZigguratGaussianSampler
    +    extends SamplerBase
    +    implements NormalizedGaussianSampler {
    +
    +    /**
    +     * Generates values from Gaussian (normal) probability distribution
    +     * It uses two tables, integers KN and reals WN. Some 99% of the time,
    +     * the required x is produced by:
    +     * generate a random 32-bit integer j and let i be the index formed 
from
    +     * the rightmost 8 bits of j. If j < k_i return x = j * w_i.
    +     */
    +
    +    private static final int[] KN = new int[128];
    +    private static final double[] WN = new double[128];
    +    private static final double[] FN = new double[128];
    --- End diff --
    
    We need Javadocs for these fields. Even though there is a comment above KN, 
that's treated only as KN's comment. Perhaps one simple, short, comment for 
each KN, WN, and FN variables.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to