smol-rs / fastrand

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

Some questions #68

Closed chris-ha458 closed 1 year ago

chris-ha458 commented 1 year ago
  1. Some((hash << 1) | 1) https://github.com/smol-rs/fastrand/blob/d5e477558db6599f73eec73f261526aa2f4b20da/src/global_rng.rs#L196C26-L196C26 As far as I can tell, this part of code has no possibility of returning None. I cannot tell why it would be necessary as well. Is there any historical reason to do so? If not I think it can be safely unwrapped into u64

  2. wyhash implementation lib.rs mentions that

    //! The implementation uses [Wyrand](https://github.com/wangyi-fudan/wyhash), a simple and fast

    However, it is only used in benches, and it is a dev-dependency. Can we change the documentation to reflect that, although the benches here relies on wyrand, downstream users do not need to rely on it?

taiki-e commented 1 year ago
  1. It will not return None in the environment where that function is used, but another function with the same name may be used in another environment and return None.
  2. It is not a link to a dependency but to an algorithm (and its standard implementation).
chris-ha458 commented 1 year ago

Thanks. Now I understand.