amarlearning commented on a change in pull request #190:
URL: https://github.com/apache/commons-math/pull/190#discussion_r667349474



##########
File path: 
commons-math-legacy/src/main/java/org/apache/commons/math4/legacy/quasirandom/HaltonSequenceGenerator.java
##########
@@ -151,31 +159,44 @@ public HaltonSequenceGenerator(final int dimension, final 
int[] bases, final int
      * @param digit the j-th digit
      * @return the scrambled digit
      */
-    protected int scramble(final int i, final int j, final int b, final int 
digit) {
+    protected long scramble(final int i, final int j, final int b, final long 
digit) {
         return weight != null ? (weight[i] * digit) % b : digit;
     }
 
     /**
-     * Skip to the i-th point in the Halton sequence.
+     * jump to the i-th point in the Halton sequence.
      * <p>
      * This operation can be performed in O(1).
      *
      * @param index the index in the sequence to skip to
-     * @return the i-th point in the Halton sequence
-     * @throws org.apache.commons.math4.legacy.exception.NotPositiveException 
NotPositiveException if index &lt; 0
+     * @return the copy of this sequence
+     * @throws NotPositiveException if index &lt; 0
      */
-    public double[] skipTo(final int index) {
+    @Override
+    public LowDiscrepancySequence jump(final long index) throws 
NotPositiveException {
+        if(index < 0) {
+            throw new NotPositiveException(index);
+        }
+        HaltonSequenceGenerator copy = this.copy();
+        copy.performJump(index);
+        return copy;
+    }
+
+    /**
+     *  Do jump at the index.
+     * @param index
+     */
+    private void performJump(long index) {
         count = index;
-        return get();
     }
 
     /**
-     * Returns the index i of the next point in the Halton sequence that will 
be returned
-     * by calling {@link #get()}.
-     *
-     * @return the index of the next point
+     * Private constructor avoid side effects.
+     * @return copy of HaltonSequenceGenerator
      */
-    public int getNextIndex() {
-        return count;
+    private HaltonSequenceGenerator copy() {
+        return new HaltonSequenceGenerator(this);
     }
+
+

Review comment:
       extra line




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