Improve gray code calculation.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1481590 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
766f13f9de
commit
51fe6ff3e4
|
@ -277,7 +277,7 @@ public class SobolSequenceGenerator implements RandomVectorGenerator {
|
|||
Arrays.fill(x, 0);
|
||||
} else {
|
||||
final int i = index - 1;
|
||||
final long grayCode = i ^ (i / 2);
|
||||
final long grayCode = i ^ (i >> 1); // compute the gray code of i = i XOR floor(i / 2)
|
||||
for (int j = 0; j < dimension; j++) {
|
||||
long result = 0;
|
||||
for (int k = 1; k <= BITS; k++) {
|
||||
|
|
Loading…
Reference in New Issue