Are rand(Float32) really uniform in [0,1)?

Here’s a post from near the end of that megathread where I offered a SIMDing infinite-precision implementation that was only a few times slower than the (2-years ago) status quo (and had a plausible path to being only marginally slower).

Someone is free to take that work and make some PRs to Random. The main tasks (prototypes already in that post!) would be to:

  • Make a block-RNG implementation that can be used to produce a SIMD vector of random bits on demand. Integrate it with Random with a nice API, possibly updating other SIMD generation functions to use it also (or rather, see the next sub-bullet, which should actually be the common part).
    • Make a (maybe-not-public) immutable form to avoid the linked-post-mentioned performance loss of a mutable version (which is basically already written inline in the SIMDing rand functions, if I recall correctly). This would probably nearly eliminate the performance gap from the status quo, as discussed in that post.
  • Make a SIMDing block-based infinite-precision rand function.
  • Make a scalar version (easy!).
  • Make sure these implementations are fast on different architectures.

mbauman also did some other work that someone could try to adapt.

2 Likes