GpuRand

Trait GpuRand 

Source
pub trait GpuRand: RngCore {
    // Required methods
    fn uniform_f32(&mut self) -> f32;
    fn uniform_f64(&mut self) -> f64;
    fn normal_f32(&mut self) -> f32;
    fn normal_f64(&mut self) -> f64;
    fn normal_f32_2(&mut self) -> [f32; 2];
    fn normal_f64_2(&mut self) -> [f64; 2];
}
Expand description

Methods for float random number generation that are common in GPU/massively parallel applications. Such as uniform or normal f32/64 generation.

Required Methods§

Source

fn uniform_f32(&mut self) -> f32

Creates an f32 in the range of [0.0, 1.0) and advances the state once.

Source

fn uniform_f64(&mut self) -> f64

Creates an f64 in the range of [0.0, 1.0) and advances the state once.

Source

fn normal_f32(&mut self) -> f32

Creates an f32 with normal distribution. The value is drawn from a Gaussian of mean=0 and sigma=1 using the Box-Mueller transform. Advances the state twice.

Source

fn normal_f64(&mut self) -> f64

Creates an f64 with normal distribution. The value is drawn from a Gaussian of mean=0 and sigma=1 using the Box-Mueller transform. Advances the state twice.

Source

fn normal_f32_2(&mut self) -> [f32; 2]

Same as Self::normal_f32 but doesn’t discard the second normal value.

Source

fn normal_f64_2(&mut self) -> [f64; 2]

Same as Self::normal_f64 but doesn’t discard the second normal value.

Implementors§

Source§

impl<T: RngCore> GpuRand for T