dhardy / rand

http://doc.rust-lang.org/rand
Other
2 stars 2 forks source link

Remove `next_u128` #84

Closed pitdicker closed 6 years ago

pitdicker commented 6 years ago

I don't think next_u128 is going to be all useful.

For small RNG's It is going to be difficult to get much faster on 64-bit architectures than generating two u64s. For cryptographic RNGs that generate values in blocks the performance overhead of reading two u64 from the buffered results instead of one u128 directly should be tiny.

If we start using something like SIMD or the GPU to generate random numbers we could generate more than 64 bits at a time efficiently, but is the i128 type then the best interface? Or is it then better to work with arrays, like the proposed BlockRng?

Generating u128s is not useful for floats, one of the big uses of random numbers. And the uses of u128s are not that many either.

dhardy commented 6 years ago

I agree for the most part. Possibly AVX extensions will allow generation of larger integers, but it's still questionable whether next_u128 will be useful. Lets remove for now, and consider adding in the future only if someone has a good use-case.

Side-note: looks like I completely messed up CI with my last merge :/