pub struct JavaRandom { /* private fields */ }Expand description
A pseudo-random number generator ported from the Java standard RNG with additional utility methods better suited for rust.
Implementations§
Source§impl JavaRandom
impl JavaRandom
pub fn new(seed: i64) -> JavaRandom
pub fn new_seeded() -> JavaRandom
pub fn new_blank() -> JavaRandom
pub fn set_seed(&mut self, seed: i64)
pub fn get_seed(&self) -> i64
pub fn next_blank(&mut self)
pub fn next_int(&mut self) -> i32
pub fn next_int_bounded(&mut self, bound: i32) -> i32
pub fn next_long(&mut self) -> i64
Sourcepub fn next_float(&mut self) -> f32
pub fn next_float(&mut self) -> f32
Get the next pseudo-random single-precision float.
Sourcepub fn next_double(&mut self) -> f64
pub fn next_double(&mut self) -> f64
Get the next pseudo-random double-precision float.
Sourcepub fn next_gaussian(&mut self) -> f64
pub fn next_gaussian(&mut self) -> f64
Get the next pseudo-random double-precision Gaussian random number.
Sourcepub fn next_float_vec(&mut self) -> Vec3
pub fn next_float_vec(&mut self) -> Vec3
Get the next pseudo-random single-precision float vector, x, y and z. This is not part of the standard Java class.
Sourcepub fn next_double_vec(&mut self) -> DVec3
pub fn next_double_vec(&mut self) -> DVec3
Get the next pseudo-random double-precision float vector, x, y and z. This is not part of the standard Java class.
Sourcepub fn next_gaussian_vec(&mut self) -> DVec3
pub fn next_gaussian_vec(&mut self) -> DVec3
Get the next pseudo-random double-precision double vector, x, y and z, with Gaussian distribution. This is not part of the standard Java class.
Sourcepub fn next_choice<T: Copy>(&mut self, items: &[T]) -> T
pub fn next_choice<T: Copy>(&mut self, items: &[T]) -> T
Randomly pick an item in the given slice. This is not part of the standard Java class.
Sourcepub fn next_choice_ref<'a, T>(&mut self, items: &'a [T]) -> &'a T
pub fn next_choice_ref<'a, T>(&mut self, items: &'a [T]) -> &'a T
Randomly pick an item in the given slice and return mutable reference to it. This is not part of the standard Java class.
Sourcepub fn next_choice_mut<'a, T>(&mut self, items: &'a mut [T]) -> &'a mut T
pub fn next_choice_mut<'a, T>(&mut self, items: &'a mut [T]) -> &'a mut T
Randomly pick an item in the given slice and return mutable reference to it. This is not part of the standard Java class.
Trait Implementations§
Source§impl Clone for JavaRandom
impl Clone for JavaRandom
Source§fn clone(&self) -> JavaRandom
fn clone(&self) -> JavaRandom
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more