pub struct Halton { /* private fields */ }Expand description
The Halton struct is a generator for the Halton sequence.
Properties:
vdc0: An instance of the VdCorput struct used for generating the first dimension of the Halton sequence.vdc1: Thevdc1property is an instance of theVdCorputstruct. It is used to generate the Van der Corput sequence for the second dimension of the Halton sequence.
§Examples
use lds_rs::ilds::Halton;
let mut hgen = Halton::new(&[2, 3], &[11, 7]);
hgen.reseed(0);
let result = hgen.pop();
assert_eq!(result[0], 1024);Implementations§
Source§impl Halton
impl Halton
Sourcepub fn new(base: &[usize], scale: &[u32]) -> Self
pub fn new(base: &[usize], scale: &[u32]) -> Self
Creates a new Halton.
The new function creates a new Halton struct with specified base and scale values for two
VdCorput sequences.
Arguments:
base: Thebaseparameter is an array ofusizevalues that represents the base for each dimension of the Halton sequence. Each element in thebasearray corresponds to a dimension in the sequence.scale: Thescaleparameter is an array ofu32values that determine the scale or precision of the Halton sequence for each dimension. Each element in thescalearray corresponds to a dimension in the Halton sequence. The larger the value ofscale, the more precise the Halton sequence.
Returns:
The new function is returning an instance of the Halton struct.
Sourcepub fn pop(&mut self) -> [usize; 2]
pub fn pop(&mut self) -> [usize; 2]
The pop function returns an array containing the pop values of two Halton instances.
Returns:
An array of two usize values is being returned.
Sourcepub fn reseed(&mut self, seed: usize)
pub fn reseed(&mut self, seed: usize)
The below code is a Rust function called reseed that is used to reset the state of a sequence
generator to a specific seed value. This allows the sequence generator to start generating the
sequence from the beginning or from a specific point in the sequence, depending on the value of the
seed.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Halton
impl RefUnwindSafe for Halton
impl Send for Halton
impl Sync for Halton
impl Unpin for Halton
impl UnwindSafe for Halton
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