You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
315 B
17 lines
315 B
// Generate halton sequence
|
|
// https://en.wikipedia.org/wiki/Halton_sequence
|
|
function halton(index, base) {
|
|
var result = 0;
|
|
var f = 1 / base;
|
|
var i = index;
|
|
|
|
while (i > 0) {
|
|
result = result + f * (i % base);
|
|
i = Math.floor(i / base);
|
|
f = f / base;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
export default halton; |