@thi.ng/lowdisc
v1.0.31
Published
n-dimensional low-discrepancy sequence generators/iterators
Maintainers
Readme
[!NOTE] This is one of 212 standalone projects, maintained as part of the @thi.ng/umbrella monorepo and anti-framework.
🚀 Please help me to work full-time on these projects by sponsoring me on GitHub. Thank you! ❤️
About
n-dimensional low-discrepancy sequence generators/iterators.
This package provides the following n-dimensional low-discrepancy sequence generators, partially based on the article The Unreasonable Effectiveness of Quasirandom Sequences by Martin Roberts.
Halton
Configurable basis for each dimension:
haltonND([2,3])

Kronecker
Configurable basis for each dimension:
kroneckerND([1 / 2 ** 0.5, 1 / 5 ** 0.5])

R2 recurrence
Based on Kronecker with each dimension's base automatically derived from the Plastic number:
plasticND(2)

Status
BETA - possibly breaking changes forthcoming
Search or submit any issues for this package
Related packages
- @thi.ng/poisson - nD Stratified grid and Poisson-disc sampling w/ support for spatial density functions and custom PRNGs
- @thi.ng/random - Pseudo-random number generators w/ unified API, distributions, weighted choices, ID generation
Installation
yarn add @thi.ng/lowdiscESM import:
import * as ld from "@thi.ng/lowdisc";Browser ESM import:
<script type="module" src="https://esm.run/@thi.ng/lowdisc"></script>For Node.js REPL:
const ld = await import("@thi.ng/lowdisc");Package sizes (brotli'd, pre-treeshake): ESM: 458 bytes
Dependencies
Usage examples
Two projects in this repo's /examples directory are using this package:
| Screenshot | Description | Live demo | Source | |:-------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------|:-------------------------------------------------------|:------------------------------------------------------------------------------------| | | Quasi-random lattice generator | Demo | Source | | | Interactive scatter & line plot of low-discrepancy samples | Demo | Source |
API
TODO
Authors
If this project contributes to an academic publication, please cite it as:
@misc{thing-lowdisc,
title = "@thi.ng/lowdisc",
author = "Karsten Schmidt",
note = "https://thi.ng/lowdisc",
year = 2020
}License
© 2020 - 2025 Karsten Schmidt // Apache License 2.0
