Skip to content
Snippets Groups Projects
Commit 87aa5b05 authored by STEVAN Antoine's avatar STEVAN Antoine :crab:
Browse files

fix "draw alpha" issue (!2)

closes #3
parent ebc892dd
Branches
Tags
1 merge request!2fix "draw alpha" issue
......@@ -26,10 +26,12 @@ pub trait ReseedableRng {
/// # Panics
/// This panics if this object is not able to draw a random value from this field.
fn draw_alpha<F: Field>(&mut self) -> F {
// TODO? retry on error?
// This has never failed during tests, but this should be tested with other fields.
self.next_bytes(|bytes| F::from_random_bytes(bytes))
.expect("Failed to draw alpha")
loop {
if let Some(alpha) = self.next_bytes(|bytes| F::from_random_bytes(bytes)) {
return alpha;
}
}
}
/// Draws a [`Vec`] of `count` positions, each of them being strictly less than `domain_size`.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment