[perl #115928] a consistent rand() implementation

Based on Yves' random branch work

I've also added a 64-bit implementation when HAS_QUAD is true, this
should be significantly faster, even on 32-bit CPUs.  This is intended to
produce excactly the same sequence as the original implementation.