Project

halton

0.0
The project is in a healthy, maintained state
A module implementing the fast generation of Halton sequences. The method of generation is adapted from "Fast, portable, and reliable algorithm for the calculation of Halton number" by Miroslav Kolář and Seamus F. O'Shea.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

Halton¶ ↑

A Ruby library for the fast generation of 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.

grid = 10.times.map {10.times.map {"."}}
Halton.each(2, 3).take(26).zip("A".."Z") do |(x, y), c|
  grid[y * 10][x * 10] = c
end
grid.each {|row| puts 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 . . . .

The method of generation is adapted from “Fast, portable, and reliable algorithm for the calculation of Halton numbers” by Miroslav Kolář and Seamus F. O’Shea.

Install¶ ↑

Install via Rubygems:

gem install halton

or add it to your Gemfile if you’re using Bundler:

gem "halton"

and then run the bundle command to install.

This gem requires a Rust compiler and the cargo build tool to build the gem’s native extension. See www.rust-lang.org/tools/install for how to install Rust. cargo is usually part of the Rust installation.