News for hackers. Stuff that matters.
Re:Higher Quality Random Floats by 10000truths on Wednesday October 18, 2023 @04:38PM (#37934462)
This is exactly how random floats are computed in the Zig standard library:

https://github.com/ziglang/zig/pull/10428/

Re:Higher Quality Random Floats by leiroigh on Wednesday October 18, 2023 @04:58PM (#37934672)
This is awesome and the first precedent I've ever seen for a standard library doing the right thing on rand floats. Big kudos to the zig people and thanks for brightening my day!
Re:Higher Quality Random Floats by corsix on Wednesday October 18, 2023 @05:22PM (#37934946)
Oh, cute. It looks like they ever-so-slightly overweight the probability of values whose mantissa is entirely zeroes though. For example, the probability of hitting exactly 0.5 should be 2^-54 + 2^-55, whereas zig looks to give it 2^-54 + 2^-54.