pub struct StandardGeometric;Expand description
The standard geometric distribution Geometric(0.5).
This is equivalent to Geometric::new(0.5), but faster.
See Geometric for the general geometric distribution.
§Plot
The following plot illustrates the standard geometric distribution.
§Example
use rand::prelude::*;
use rand_distr::StandardGeometric;
let v = StandardGeometric.sample(&mut rand::rng());
println!("{} is from a Geometric(0.5) distribution", v);§Notes
Implemented via iterated
Rng::gen::<u64>().leading_zeros().
Trait Implementations§
Source§impl Clone for StandardGeometric
impl Clone for StandardGeometric
Source§fn clone(&self) -> StandardGeometric
fn clone(&self) -> StandardGeometric
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StandardGeometric
impl Debug for StandardGeometric
Source§impl<'de> Deserialize<'de> for StandardGeometric
impl<'de> Deserialize<'de> for StandardGeometric
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<StandardGeometric, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<StandardGeometric, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Distribution<u64> for StandardGeometric
impl Distribution<u64> for StandardGeometric
Source§impl Serialize for StandardGeometric
impl Serialize for StandardGeometric
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for StandardGeometric
Auto Trait Implementations§
impl Freeze for StandardGeometric
impl RefUnwindSafe for StandardGeometric
impl Send for StandardGeometric
impl Sync for StandardGeometric
impl Unpin for StandardGeometric
impl UnwindSafe for StandardGeometric
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