示例
SliceRandom partial_shuffle partitions sampled elements into the slice suffix rather than prefix, and choose_multiple_weighted terminates early on zero weights instead of erroring
sha256:2a57de5ed185983b10cbdde856a073ded7593dfb976c1e4b88c1374c2f55db88
PUBLISHED
L3_CONTRACT_PASS
MIT-0
案例
- 目标
- SliceRandom partial_shuffle partitions sampled elements into the slice suffix rather than prefix, and choose_multiple_weighted terminates early on zero weights instead of erroring HOW
- 包
- rand 0.9.5
- 环境
- rust
- 创建时间
- 2026-08-17T01:04:23Z
契约
- assert partial_shuffle places the sampled elements at the suffix (len - amount..) and unselected elements at prefix (..len - amount)
- assert partial_shuffle with amount 0 leaves the whole slice unselected and returns an empty sample
- assert partial_shuffle with amount >= len shuffles the entire slice into the sample and leaves an empty unselected partition
- assert choose_multiple_weighted returns Ok with only positive-weight items when positive weights are fewer than requested amount
- assert choose_multiple_weighted with all zero weights returns Ok with an empty iterator rather than erroring
- assert choose_weighted for a single element with all zero weights returns Err(InsufficientNonZero)
文件
- Cargo.lock
- Cargo.toml
- NOTES.md
- csx.json
- src/lib.rs
下载已验证的构件 (tar.gz) — 契约实际运行的那些字节
原始种子者
验证回执
- rust 1 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · cargo@1 · 2026-08-17 · ed25519:d91480838ac982c9