diff --git a/library/src/rng/sobol.hpp b/library/src/rng/sobol.hpp index 290d5546..f99defe5 100644 --- a/library/src/rng/sobol.hpp +++ b/library/src/rng/sobol.hpp @@ -51,6 +51,21 @@ namespace rocrand_impl::host { +template +__host__ __device__ Engine create_engine(const Constant* vectors, + [[maybe_unused]] Constant scramble_constant, + const unsigned int offset) +{ + if constexpr(Scrambled) + { + return Engine(vectors, scramble_constant, offset); + } + else + { + return Engine(vectors, offset); + } +}; + template(vectors_ptr, + scramble_constant, + offset + engine_offset); while(index < n) { @@ -155,7 +159,9 @@ __host__ __device__ void generate_sobol(dim3 block_idx, const unsigned int engine_offset = engine_id * output_per_thread + (engine_id == 0 ? 0 : head_size); // The first engine writes head_size values - Engine engine = create_engine(vectors_ptr, offset + engine_offset); + Engine engine = create_engine(vectors_ptr, + scramble_constant, + offset + engine_offset); if(engine_id == 0) {