-
Notifications
You must be signed in to change notification settings - Fork 432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Meta: add bit / bit-range sampling to RngCore #1147
Comments
Summarising from #1014:
|
@riking posted:
|
@riking so your suggestion is essentially to add a method like this? pub trait RngCore {
// existing methods here
/// Request random bits
///
/// If this method is used, all guarantees regarding reproducibility are void.
fn fill_bits(&mut self, buf: &mut [u8], n_bits: usize) {
// Default impl over other methods for backwards compatibility;
// implementors may provide a faster impl as suggested over a buffer
} (Or even add a method This may be worth investigating, though I'm a little sceptical of the performance and not entirely keen on the additional complexity of the API. |
I'm going to close this:
|
This is a topic that has come up a few times and deserves its own issue. Related:
WeightedIndex
#1014 mentions an algorithm requiring bit-level sampling for performance; some discussion of how to achieve thisThe text was updated successfully, but these errors were encountered: