MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / sample_with_replacement

Method sample_with_replacement

nodedb/src/engine/random/alias.rs:137–139  ·  view source on GitHub ↗

Sample `count` indices with replacement (same index can appear multiple times).

(&self, rng: &mut SeedableRng, count: usize)

Source from the content-addressed store, hash-verified

135
136 /// Sample `count` indices with replacement (same index can appear multiple times).
137 pub fn sample_with_replacement(&self, rng: &mut SeedableRng, count: usize) -> Vec<usize> {
138 (0..count).map(|_| self.sample(rng)).collect()
139 }
140
141 /// Number of items in the distribution.
142 pub fn len(&self) -> usize {

Callers 2

weighted_pickFunction · 0.80

Calls 2

collectMethod · 0.80
sampleMethod · 0.80

Tested by 1