Don't assume u32 alignment of random() state buffer
This MR addresses the issue of using u32
-based algorithms on a possibly user-supplied (char *
) state buffer that is not required to be u32
-aligned. This means lots of to_ne_bytes()
and from_ne_bytes()
, but that seems to be the price to pay for avoiding UB.
Another fix included here is the use of a proper wrapping_add()
instead of a possibly panicking +=
in the random()
function.