Skip to content

Commit

Permalink
make distribution less biased to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
CAHEK7 committed Oct 17, 2023
1 parent 75ee932 commit 3a95ba3
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions test/random.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ namespace prng {
template <typename T>
inline T gen_descreet_uniform_sign(double scale, int32_t range)
{
return static_cast<T>((gen_canonical<int>() ? -scale : scale) *
static_cast<double>(gen_0_to_B(range)));
return static_cast<T>(scale * prng::gen_A_to_B(-range + 1, range));
}

template <typename T>
Expand Down

0 comments on commit 3a95ba3

Please sign in to comment.