Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uniform_01 generator #47

Open
DiscreteLogarithm opened this issue Oct 23, 2018 · 0 comments
Open

uniform_01 generator #47

DiscreteLogarithm opened this issue Oct 23, 2018 · 0 comments

Comments

@DiscreteLogarithm
Copy link

DiscreteLogarithm commented Oct 23, 2018

There's this comment in uniform_01.hpp:

Note: The current implementation is buggy, because it may not fill
all of the mantissa with random bits. I'm unsure how to fill a
(to-be-invented) @c boost::bigfloat class with random bits efficiently.

We do have an efficient algorithm (see section 4 of this preprint) and a C++ implementation capable of generating all representable floating-point numbers in [0,1). It fills the mantissa with a random integer and generates a geometric random number for the exponent. In the double precision case, it is even faster than simply multiplying a 64-bit integer by 2-64 and in the single precision case it's only 25% slower than multiplying a 32-bit integer by 2-32 (when used with the MT19937 URBG).

If you are interested we can help to integrate it into boost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant