Realized about a 10x speedup.
- add benches/million-updates.rs
- optimization: use rand instead of nanorand (because of thread_rng() initialization being muchf aster)
- update README
Signed-off-by: Stephen Waits <steve@waits.net>
Made `HeightVector` numerically safe; while `Vector` remains numerically unsafe (i.e. it can divide by 0, NaN, Inf, etc).
When HeightVector runs into a problem, it just re-randomizes itself. Since the algorithm converges relatively quickly, this seems to work fine.
Also fixed a bug so that now height will always start as a positive number (and stay that way, else get re-randomized).
Added safety to `NetworkCoordinate` which now checks that its error didn’t pull a `HeightVector` into a negative height; in which case it also re-randomizes.
Clarified the `random` construction, tweaked the DEFAULT_ERROR constant, and updated tests accordingly.
Signed-off-by: Stephen Waits <steve@waits.net>