quasi-rd

Crates.ioquasi-rd
lib.rsquasi-rd
version0.1.0
sourcesrc
created_at2019-12-20 02:18:33.513061
updated_at2019-12-20 02:18:33.513061
descriptionGenerate quasirandom Rd sequences
homepage
repositoryhttps://github.com/TomCrypto/quasi-rd
max_upload_size
id190813
size59,930
Thomas Bénéteau (TomCrypto)

documentation

README

quasi-rd

Documentation Crates.io

An implementation of the quasirandom Rd sequence described in this blog post. This sequence may not necessarily be optimal for all dimensionalities or all applications but it has the advantage of working quite well in general, being very fast to generate and also being parameter-free as all the parameters are fixed and thus do not require application-specific configuration.

This implementation does not use floating-point arithmetic to compute the sequence but uses a 128-bit fixed-point representation, only converting to floating-point as a final step if required. As a result it produces exact sequences of up to 2^64 samples, which should be enough for almost every application. Parameters for up to 1M-dimensional sequences are computed to within 128 bits of accuracy using rational arithmetic.

Usage

This code generates quasirandomly distributed points in two dimensions:

use quasi_rd::Sequence;

let mut sequence = Sequence::new(2);

for _ in 0..500 {
    println!("({}, {})", sequence.next_f64(), sequence.next_f64());
}

Plotting these points will produce a distribution like this:

License

This crate is licensed under the terms of the MIT license. See LICENSE.md for more information.

Commit count: 4

cargo fmt