taken from https://github.com/sebdevine/sobol-kj
