# uniform_float

This is a small header-only library implementing a handful of routines for

uniform sampling in floating-point. See the blog posts Sampling in

Floating Point (1/3): The Unit

Interval

and Sampling in Floating Point (2/3): 1D

Intervals

for further context and documentation.

The main entrypoints are:

`Sample01()`

: returns uniform floating-point values in [0,1).`SampleToPowerOfTwo(x)`

: uniformly samples in [0,2^x).`SampleRange(a, b)`

: uniformly samples in [a,b).

It is expected that the user will provide implementations of two functions

to generate random values:

```
uint64_t Random64Bits();
uint32_t Random32Bits();
```

For previous implementations of these ideas, see:

- Christoph Conrads’s Rademacher Floating Point

Library, in

particular the

make_uniform_random_value()

function. - Olaf Bernstein’s

dist_uniformf_dense(). - Marc Reynolds’s Higher density uniform

floats

blog post.