Document that xorshift can't be seeded with zero
Minoru opened this issue · comments
When seeded with zero, xorshift is silently seeded with a different value:
Lines 86 to 91 in 7cda1f8
The docs don't mention this though.
When seeding from another RNG, the situation is even worse: if the seeding RNG keeps returning zeroes, xorshift's initialization will loop forever:
Lines 102 to 108 in 7cda1f8
from_rng
is fallible, so it could perform a limited number of iterations and fail if it can't get a non-zero seed.
I think that, at the very least, these behaviours should be documented.
I agree that the behavior for 0 seeds should be documented. However, I disagree that we should add special code for pathological RNG implementations that always return 0. Such behavior would break a lot of code in Rand, because rejection sampling is used in many algorithms.