smol-rs / fastrand

A simple and fast random number generator
Apache License 2.0
386 stars 33 forks source link

Remove interior mutability from Rng #47

Closed notgull closed 1 year ago

notgull commented 1 year ago

This PR removes interior mutability from the Rng type by removing the Cell from inside of it and making all of its methods take &mut. This closes #31, and also helps with #36 as a side effect, since we can't call u64() anymore from &self.

This is a breaking change, but resolving most of our current issues would require a breaking change as well.

Closes #26 Closes #38

taiki-e commented 1 year ago

LGTM, but we may want to create a new 1.x release that includes https://github.com/smol-rs/fastrand/pull/35 before merging this.

taiki-e commented 1 year ago

I think this will also close https://github.com/smol-rs/fastrand/pull/26 and https://github.com/smol-rs/fastrand/pull/38.

closes #36 as a side effect

To close it, perhaps we may want to add a fork function with the same behavior as the current clone.

notgull commented 1 year ago

LGTM, but we may want to create a new 1.x release that includes #35 before merging this.

Cool, I opened #48

notgull commented 1 year ago

48 is closed, so I'll merge this. More changes to come.