Skip to content

Commit

Permalink
Switch to [0,1) method w/o (second) bit-shift
Browse files Browse the repository at this point in the history
  • Loading branch information
rstub committed Sep 17, 2023
1 parent eea9689 commit 616c4d9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions inst/include/dqrng_distribution.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ using normal_distribution = boost::random::normal_distribution<double>;
using exponential_distribution = boost::random::exponential_distribution<double>;

inline double uniform01(uint64_t x) {
// prefer high bits due to weakness of lowest bits for xoshiro/xoroshiro with used "+" scrambler
return (x >> 11) * (1. / (uint64_t(1) << 53));
// prefer high bits due to weakness of lowest bits for xoshiro/xoroshiro with the "+" scrambler
return (x >> 11) * 0x1.0p-53;
}
} // namespace dqrng

Expand Down

0 comments on commit 616c4d9

Please sign in to comment.