Changed to use crude XorShift PRNG