Skip to content

A Rust module for generating Halton sequences

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

matsadler/halton

Repository files navigation

halton

Build Version Docs

A module for generating Halton sequences, a deterministic low discrepancy sequence that appears to be random. The uniform distribution and repeatability makes the sequence ideal for choosing sample points or placing objects in 2D or 3D space.

Examples

use halton::Sequence;

let mut grid = [["."; 10]; 10];
let alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("").skip(1).take(26);
let seq = Sequence::new(2).zip(Sequence::new(3)).zip(alpha);
for ((x, y), c) in seq {
    grid[(y * 10.0) as usize][(x * 10.0) as usize] = c;
}
for row in grid.iter() {
    println!("{}", row.join(" "));
}

Outputs:

. . R . . I . . . .
. L . . . . U C . .
X . . F . . . . . O
. . . J . A . . . .
. D . . . . M S . .
P . . . V . . . G .
. . B . . Y . . . .
. T . . . . E . K .
H . . . N . . . . W
. . . Z . Q . . . .

License

This project is licensed under either of

at your option.

About

A Rust module for generating Halton sequences

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages