Trait relearn::spaces::SampleSpace
source · [−]pub trait SampleSpace: NonEmptySpace {
fn sample(&self, rng: &mut dyn RngCore) -> Self::Element;
}
Expand description
A space from which samples can be drawn.
No particular distribution is specified but the distribution:
- must have support equal to the entire space, and
- should be some form of reasonable “standard” distribution for the space.
Note
This re-implements sample method of Distribution
rather than set
Distribution<Self::Element>
as a super-trait so that SampleSpace
is object-safe since
Distribution<T>
is not object-safe, and even if it was,- generic super traits using
<Self::AssocType>
are not object safe due to a bug / issue: https://github.com/rust-lang/rust/issues/40533.