1.0.0 • Published 5 months ago
halton v1.0.0
halton
Generate n points of the Halton sequence in n-dimensions.
Installation
npm install halton
Usage
import halton from "halton";
const points = halton(pointsCount);
// =>
// 0: [0, 0]
// 1: [0.5, 0.3333333333333333]
// 2: [0.25, 0.6666666666666666]
// 3: [0.75, 0.1111111111111111]
API
halton
- halton
- .haltonSequence(index, base) ⇒ number
- .default(count, [bases]) ⇒ Array.<Array.<number>>
halton.haltonSequence(index, base) ⇒ number
The Halton sequence algorithm.
Kind: static method of halton See: Wikipedia Halton_sequence
Param | Type | Description |
---|---|---|
index | number | Index in the sequence. |
base | number | An integer, preferably prime number. |
halton.default(count, bases) ⇒ Array.<Array.<number>>
Generate n points of the Halton sequence in n-dimensions. The "bases" parameter defines how many dimensions.
Kind: static method of halton
Param | Type | Default | Description |
---|---|---|---|
count | number | Number of points in the sequence to generate. | |
bases | Array.<number> | 2, 3 | The bases for the Van der Corput operation. Best results with small coprime numbers. |
License
MIT. See license file.