MCPcopy Create free account
hub / github.com/MultiFuzz/MultiFuzz / choose

Method choose

hail-fuzz/src/dictionary.rs:37–43  ·  view source on GitHub ↗
(&self, rng: &mut R)

Source from the content-addressed store, hash-verified

35 }
36
37 pub fn choose<R: Rng>(&self, rng: &mut R) -> Option<(&[u8], u8)> {
38 let index = match ENABLE_DICTIONARY_WEIGHTS {
39 true => self.weights.as_ref()?.sample(rng),
40 false => rng.gen_range(0..self.entries.len()),
41 };
42 self.entries.iter().nth(index).map(|(_, item)| (item.value.as_slice(), item.strides))
43 }
44
45 pub fn is_empty(&self) -> bool {
46 self.entries.is_empty() || (ENABLE_DICTIONARY_WEIGHTS && self.weights.is_none())

Callers 4

extend_input_byFunction · 0.80
apply_mutationFunction · 0.80
random_strideFunction · 0.80
randomMethod · 0.80

Calls 2

is_emptyMethod · 0.80
lenMethod · 0.45

Tested by

no test coverage detected