You are right, we could reduce the file to say dimension 1000 which is slightly above 60 kilobytes. Letting the user provide custom directions is a good idea.

I also wonder if we should not use more bits for double generation. 32 bits seems small to me. In the BitStreamGenerator we use 52 bits as follows:

public double nextDouble() {
final long high = ((long) next(26)) << 26;
final int low = next(26);
return (high | low) * 0x1.0p-52d;
}

It seemed to me Sobol sequences can generate almost arbitrary number of bits. Could we set it up so it generates 52 bits and then multiply by the same constant 0x1.0p-52d?

Another point is that there are two ways to generate the sequence. The fast one you used which is based on Gray code and hence is a simple recursive operation (x = x ^ direction[c]), and a direct one which can generate any number in the sequence from its index. We could perhaps propose another method skipTo(int index) that would use the longer method and reinitialize x from this point. Users could then use skipTo to go anywhere they want in the sequence, and then they would retrieve consecutive vectors starting from there. The use cases for such a method are:

- drop the first 2^n points, as some people think it is better (but Joe Kuo does not seem to agree as shown in his notes)
- allow user to generate different sequences, by changing the start point
- implement a poor-man seed setting, the pseudo-seed being the start index

Thanks for the suggestion.

You are warmly welcome to help bring this into Commons Math by providing an implementation.