Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm going to try this instead of Halton sequences in my current project.

One detail of the implementation that may be worth improving:

        z[i] = (seed + alpha*(i+1)) %1
When i gets large, say 2^30, you're losing 30 bits of precision in the %1, so (with IEEE doubles) it can only take one of 2^23 values.

The usual implementation of Halton sequences get slower with large values of i, but doesn't suffer from quantization.



Thanks tlb. You're totally right. I wrote the example code to match the notation used in the post which is a reflection of my maths background. I suspect that from a programming perspective using the recurrence relation:

z[i+1] = (z[i] + alpha) %1

is better practice in terms of both speed and accuracy. I have updated my post to make this clearer. Thanks.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: