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:
Thomas Neidhart 2013-05-12 15:57:50 +00:00
parent 766f13f9de
commit 51fe6ff3e4
1 changed files with 1 additions and 1 deletions

View File

@ -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++) {