Halton
Generate Halton sequences of low discrepancy numbers
Usage
Require halton
var halton = require('halton');
Simplest example:
var halton = require('halton');
console.log(halton(0, 3)); // 1/3
console.log(halton(1, 3)); // 2/3
Example with bound base:
var halton = require('halton');
var base3 = halton.base(3);
console.log(base3(0)); // 1/3
console.log(base3(1)); // 2/3
API
-
<static> base(base) → {function}
-
Create a function that binds the base/bases
Parameters:
Name Type Argument Description base
Number <repeatable>
Bases to use for halton sequence
Returns:
Function whith bound bases
- Type
- function
-
<static> generate(fn, length) → {Number[]}
-
Generate a sequence of numbers
Parameters:
Name Type Description fn
function The function to use for generating sequences
length
Number Length of sequence
Returns:
Sequence of numbers
- Type
- Number[]
-
<static> increment(fn, startIndex) → {function}
-
Wrapper that returns an halton sequence that increments for each call
Parameters:
Name Type Argument Default Description fn
function Function that will be incremented
startIndex
Number <optional>
0 Start Index
Returns:
Function that increments index for each call
- Type
- function
generated with docme