Skip to content

Commit

Permalink
Make sure that all operants are of same type when handling PCG64 stream
Browse files Browse the repository at this point in the history
  • Loading branch information
rstub committed May 16, 2024
1 parent 4287aca commit fd688fb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion inst/include/dqrng_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ inline void random_64bit_wrapper<pcg64>::set_stream(result_type stream) {
state.push_back(number);
// state[1] is the current stream
// PCG will do 2*stream + 1 to make sure stream is odd; need to revert that here
gen.set_stream(state[1]/2 + stream);
gen.set_stream(state[1]/pcg_extras::pcg128_t(2) + pcg_extras::pcg128_t(stream));
}

// keep using the two argument ctor for PCG for backwards compatibility
Expand Down
2 changes: 1 addition & 1 deletion inst/include/pcg_random.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ class specific_stream {

void set_stream(itype specific_seq)
{
inc_ = (specific_seq << 1) | 1;
inc_ = (specific_seq << 1) | itype(1U);
}

static constexpr bool can_specify_stream = true;
Expand Down

0 comments on commit fd688fb

Please sign in to comment.