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

**URL:** https://discourse.julialang.org/t/are-rand-float32-really-uniform-in-0-1/133585
**Category:** General Usage
**Tags:** question
**Created:** [October 31, 2025, 11:03pm UTC](https://discourse.julialang.org/t/are-rand-float32-really-uniform-in-0-1/133585 "2025-10-31T23:03:53Z")
**Posts on this page:** 1
**Showing post:** 19

<div class="post-metadata">

### Author: ![mikmoore](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mikmoore/32/31109_2.png) [@mikmoore](https://discourse.julialang.org/u/mikmoore)
#### Post date: [November 3, 2025, 5:24pm UTC](https://discourse.julialang.org/t/are-rand-float32-really-uniform-in-0-1/133585/19 "2025-11-03T17:24:45Z")

</div>

[Here’s a post](https://discourse.julialang.org/t/output-distribution-of-rand-float32-and-rand-float64-thread-2/105184/435) 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](https://discourse.julialang.org/t/output-distribution-of-rand-float32-and-rand-float64-thread-2/105184/439) that someone could try to adapt.

---

_[View the full topic](https://discourse.julialang.org/t/are-rand-float32-really-uniform-in-0-1/133585)._
