-
-
Notifications
You must be signed in to change notification settings - Fork 473
Description
Background
What is your motivation?
I came across this interesting pull request that someone made on the official Swift programming language repository
It makes some very intriguing claims, stating such as:
reduces the worst-case expected number of random bits required from O(log₂(upperBound)) to log₂(upperBound) + O(1), which is optimal
and
this algorithm can be made unconditional by removing the early out, so that every value computed requires word size + 64 bits from the stream, which breaks the loop-carried dependency for fast generators, unlocking vectorization and parallelization where it was previously impossible
And I was wondering if this might similarly be useful in your rand crate
What type of application is this? (E.g. cryptography, game, numerical simulation)
All applications of random number generation. And from what I understand could make SIMD improvements for random number generation possible also?
Feature request
I request that the rand crate authors have a look at this algorithm swiftlang/swift#39143 and that they determine whether it could be implemented into the rand crate to improve performance for the generation of random numbers.
And alternatively, if it is something that needs language support inside of Rust itself. I am not able to determine on my own whether such is the case or not.