fastrand icon indicating copy to clipboard operation
fastrand copied to clipboard

Custom range for floats

Open IceSentry opened this issue 3 years ago • 1 comments

Currently, floats only generate in a range of 0..1

It's pretty easy to convert it in the user side to a specific range, but is there a reason why there isn't a way to do this directly? Since this would be a breaking change, maybe add a fastrand::f64_range(range).

IceSentry avatar Jun 09 '21 16:06 IceSentry

The current one has the same behavior as rand's random.

However, I don't think there is any reason why {f32,f64}_range is not available, so I would accept a PR to add {f32,f64}_range.

taiki-e avatar Jun 24 '21 15:06 taiki-e

This is now exposed in fastrand-contrib v0.1.0.

notgull avatar Sep 17 '23 16:09 notgull