[libcxx-commits] [PATCH] D114129: [libc++] Fix `uniform_int_distribution` for 128-bit result type

Fabian Wolff via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Nov 18 13:05:24 PST 2021


fwolff updated this revision to Diff 388290.
fwolff added a comment.

> Is `uniform_int_distribution` really the only distribution with this kind of problem? What about, I dunno, `binomial_distribution`?

`binomial_distribution` also seems to be affected, and maybe others as well. But I haven't looked into them deeply yet, and it's not obvious from looking at the code briefly what causes the problem there.

Also, is there a reason why `uniform_int_distribution.h` defines its own `independent_bits_engine` instead of using the one from the `random` header?

And, out of curiosity, because I haven't been able to figure it out by myself and must be overlooking something: Do you happen to know why the simple definition of `independent_bits_engine` (here <http://open-std.org/JTC1/SC22/WG21/docs/papers/2006/n2079.pdf>, 26.4.4.2) was dropped in favor of the much more complicated one that made it into the standard <http://eel.is/c%2B%2Bdraft/rand.adapt.ibits>?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114129/new/

https://reviews.llvm.org/D114129

Files:
  libcxx/include/__bits
  libcxx/include/__random/uniform_int_distribution.h
  libcxx/test/std/numerics/rand/rand.dis/rand.dist.uni/rand.dist.uni.int/int128.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D114129.388290.patch
Type: text/x-patch
Size: 6420 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20211118/5199fa8f/attachment.bin>


More information about the libcxx-commits mailing list