pub struct RandomBool {
pub true_probability: f64,
}Expand description
随机布尔值生成器
Fields§
§true_probability: f64为 true 的概率 (0.0 - 1.0)
Implementations§
Source§impl RandomBool
impl RandomBool
Sourcepub fn probability(self, prob: f64) -> Self
pub fn probability(self, prob: f64) -> Self
设置 true 的概率
Sourcepub fn generate(&self) -> TestingResult<bool>
pub fn generate(&self) -> TestingResult<bool>
生成随机布尔值
Trait Implementations§
Source§impl Clone for RandomBool
impl Clone for RandomBool
Source§fn clone(&self) -> RandomBool
fn clone(&self) -> RandomBool
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RandomBool
impl Debug for RandomBool
Source§impl Default for RandomBool
impl Default for RandomBool
Source§fn default() -> RandomBool
fn default() -> RandomBool
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for RandomBool
impl RefUnwindSafe for RandomBool
impl Send for RandomBool
impl Sync for RandomBool
impl Unpin for RandomBool
impl UnsafeUnpin for RandomBool
impl UnwindSafe for RandomBool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more