Closed ctbur closed 5 years ago
As were using the library in our game project we had noticed that before (currently were working around by catching the exception it by invoking it again with different seed) and I had created issue for it (#16), but that issue is brief and lacks context so I will close it in favor of this one.
This is one reason why I had been hesitant releasing new versions as I hadn't fixed it yet. (Other big one is that I would really like to rewrite the API as it's way too complex for what it is.)
I'll try to look at it fresh mind and see if I can figure it out this time.
This can be reproduced with
let seed = [160, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
let rng = SmallRng::from_seed(seed);
let poisson = Builder::<_, na::Vector2<f32>>::with_radius(0.004, Type::Normal)
.build(rng, algorithm::Bridson)
.generate();
using rand 0.6.5, nalgebra 0.17.3 and poisson 0.10.0
When using Bridson's algorithm to generate the samples I get the following panic in rare cases:
The algorithm is built with these parameters:
I could not find a way to print the state of the XorShiftRng
rng
, but I can say that theindex
inbridson.rs
that causes the illegal unwrap is(176.0, 154.0)
.