wasmtime_environ::__core::random

Trait Random

source
pub trait Random: Sized {
    // Required method
    fn random(source: &mut (impl RandomSource + ?Sized)) -> Self;
}
🔬This is a nightly-only experimental API. (random)
Expand description

A trait for getting a random value for a type.

Warning: Be careful when manipulating random values! The random method on integers samples them with a uniform distribution, so a value of 1 is just as likely as i32::MAX. By using modulo operations, some of the resulting values can become more likely than others. Use audited crates when in doubt.

Required Methods§

source

fn random(source: &mut (impl RandomSource + ?Sized)) -> Self

🔬This is a nightly-only experimental API. (random)

Generates a random value.

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§