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

Function without_replacement_all

nodedb/src/engine/random/alias.rs:229–236  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

227
228 #[test]
229 fn without_replacement_all() {
230 let weights = vec![1.0, 1.0, 1.0];
231 let table = AliasTable::new(&weights).unwrap();
232 let mut rng = SeedableRng::from_seed_str("all");
233
234 let selected = table.sample_without_replacement(&mut rng, 10); // More than n.
235 assert_eq!(selected.len(), 3);
236 }
237
238 #[test]
239 fn with_replacement_allows_duplicates() {

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected