Trait libafl::bolts::rands::Rand [−][src]
pub trait Rand: Debug + Serialize + DeserializeOwned {
fn set_seed(&mut self, seed: u64);
fn next(&mut self) -> u64;
fn below(&mut self, upper_bound_excl: u64) -> u64 { ... }
fn between(&mut self, lower_bound_incl: u64, upper_bound_incl: u64) -> u64 { ... }
fn choose<I, E, T>(&mut self, from: I) -> T
where
I: IntoIterator<Item = T, IntoIter = E>,
E: ExactSizeIterator + Iterator<Item = T>,
{ ... }
}
Expand description
Ways to get random around here Please note that these are not cryptographically secure Or, even if some might be by accident, at least they are not seeded in a cryptographically secure fashion.
Required methods
Provided methods
Gets a value below the given 64 bit val (inclusive)
Gets a value between the given lower bound (inclusive) and upper bound (inclusive)
fn choose<I, E, T>(&mut self, from: I) -> T where
I: IntoIterator<Item = T, IntoIter = E>,
E: ExactSizeIterator + Iterator<Item = T>,
fn choose<I, E, T>(&mut self, from: I) -> T where
I: IntoIterator<Item = T, IntoIter = E>,
E: ExactSizeIterator + Iterator<Item = T>,
Choose an item at random from the given iterator, sampling uniformly.
Note: the runtime cost is bound by the iterator’s nth
implementation
- For
Vec
, slice, array, this is O(1) - For
HashMap
,HashSet
, this is O(n)