moonlander_gp

Trait RandNode

Source
pub trait RandNode: Sized {
    // Required method
    fn rand(weights: NodeWeights, rng: &mut dyn Rng) -> Self;
}
Expand description

Implement trait to generate random subtrees of a given type.

This trait is like rand::Rand, but it doesn’t require that the Rng instance is Sized, so that we can combine it with the Mutatable trait.

It also takes a parameter that controls the height of trees that will be randomly generated. The NodeWeights parameter will indicate the relative weights to be used when deciding between generating internal vs. leaf nodes in the tree.

Required Methods§

Source

fn rand(weights: NodeWeights, rng: &mut dyn Rng) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§