Added pseudo-random shuffle for testing.
Fixed issue on 64-bit.