pub struct UnitCircle;
Expand description
Samples uniformly from the edge of the unit circle in two dimensions.
Implemented via a method by von Neumann1.
§Example
use rand_distr::{UnitCircle, Distribution};
let v: [f64; 2] = UnitCircle.sample(&mut rand::thread_rng());
println!("{:?} is from the unit circle.", v)
von Neumann, J. (1951) Various Techniques Used in Connection with Random Digits. NBS Appl. Math. Ser., No. 12. Washington, DC: U.S. Government Printing Office, pp. 36-38. ↩
Trait Implementations§
Source§impl Clone for UnitCircle
impl Clone for UnitCircle
Source§fn clone(&self) -> UnitCircle
fn clone(&self) -> UnitCircle
Returns a copy 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 UnitCircle
impl Debug for UnitCircle
Source§impl<F: Float + SampleUniform> Distribution<[F; 2]> for UnitCircle
impl<F: Float + SampleUniform> Distribution<[F; 2]> for UnitCircle
impl Copy for UnitCircle
Auto Trait Implementations§
impl Freeze for UnitCircle
impl RefUnwindSafe for UnitCircle
impl Send for UnitCircle
impl Sync for UnitCircle
impl Unpin for UnitCircle
impl UnwindSafe for UnitCircle
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 0 bytes