Trait SampleRange
Source pub trait SampleRange {
type Output;
// Required method
fn sample(self) -> Self::Output;
}
Available on crate features rand-expand and rand only.
Expand description
可从区间采样的类型。
- 整数区间采用拒绝采样实现无偏取模,不引入模偏差;
- 浮点区间按
start + random::<T>() * (end - start) 缩放。
§Feature Requirement
需要启用 "rand-expand" 特性。
§Examples
use lib_unknown::rand::random_range;
let v = random_range(0..10u32);
assert!(v < 10);
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.
Available on crate feature rand-expand only.