soroban_sdk::prng

Trait GenRange

Source
pub trait GenRange {
    type RangeBound;

    // Required method
    fn gen_range(prng: &Prng, r: impl RangeBounds<Self::RangeBound>) -> Self;
}
Expand description

Implemented by types that support being generated in a specific range by a Prng.

Required Associated Types§

Required Methods§

Source

fn gen_range(prng: &Prng, r: impl RangeBounds<Self::RangeBound>) -> Self

Generates a value of the implementing type with the Prng in the specified range.

§Panics

If the range is empty.

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.

Implementations on Foreign Types§

Source§

impl GenRange for u64

Source§

type RangeBound = u64

Source§

fn gen_range(prng: &Prng, r: impl RangeBounds<Self::RangeBound>) -> Self

Implementors§