uniform_01 generator

Open
#47 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
tooling

Research direction

Start with the comment in uniform_01.hpp, then read section 4 of the linked preprint and the referenced canonical-random-float C++ implementation. The work is complete when uniform_01 generates all representable floating-point values in [0,1) while filling the mantissa with random bits.

Written by the indexing model from the issue text.

Description

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.

Dominant language
C++
Stars
42
Forks
76
Avg merge
3d 22h
Merged PRs (30d)
6

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/random

All issues in boostorg/random

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.