Module sample
Expand description
Strategies for generating values by taking samples of collections.
Note that the strategies in this module are not native combinators; that is, the input collection is not itself a strategy, but is rather fixed when the strategy is created.
Structs§
- Index
- A stand-in for an index into a slice or similar collection or conceptually similar things.
- Index
Strategy - Strategy to create
Index
es. - Index
Value Tree ValueTree
corresponding toIndexStrategy
.- Select
- Strategy to produce one value from a fixed collection of options.
- Select
Value Tree ValueTree
corresponding toSelect
.- Selector
- A value for picking random values out of iterators.
- Selector
Strategy - Strategy to create
Selector
s. - Selector
Value Tree ValueTree
corresponding toSelectorStrategy
.- Size
Range - The minimum and maximum range/bounds on the size of a collection.
The interval must form a subset of
[0, std::usize::MAX)
. - Subsequence
- Strategy to generate
Vec
s by sampling a subsequence from another collection. - Subsequence
Value Tree ValueTree
type forSubsequence
.
Functions§
- select
- Create a strategy which uniformly selects one value from
values
. - size_
range - Creates a
SizeRange
from some value that is convertible into it. - subsequence
- Sample subsequences whose size are within
size
from the given collectionvalues
.