dimforge / simba

Set of mathematical traits to facilitate the use of SIMD-based AoSoA (Array of Struct of Array) storage pattern.
Apache License 2.0
293 stars 29 forks source link

Implement `Distribution` from the `rand` crate for more types #37

Closed GabrielDertoni closed 2 years ago

GabrielDertoni commented 2 years ago

Currently there is a feature for the optional dependency rand in the simba crate. However, only the scalar types implement the traits from rand.

I don't see a reason why the Distribution trait can't be implemented with the SIMD types for Standard, such as AutoSimd. The implementation would simply generate a random value for each of the lanes of the SIMD vector. This is pretty easy to implement since impls already exist for every type used as a SIMD element.

Implementing this would allow better integration with the rand crate which is already an optional dependency.