Subject: | irand |
most random number generators have an irand() method that returns a
uniformly distributed 0..2^32-1 integer, which is much more useful in
cryptographic contexts.
It would be trivial to move the float conversion out of mt_genrand so that
it returns return uint32 for irand() and then have another routine
normalize it into a [0..1] float for rand().
Yeah, I know I could just do int(4294967296*rand), but (1) slower (2)
harder to get right if int is not truncating the right way, and (3) rather
a waste given that mt_genrand already does what we want...