unsigned Random<T_PRNG>::CalcChecksum(const PRNG& rng) { // This is designed in a way that makes the checksum be equivalent // to the state of the OldLCG for compatibility with old versions Serializer ser; rng.serialize(ser); unsigned checksum = 0; while(ser.GetBytesLeft() >= sizeof(unsigned)) checksum += ser.PopUnsignedInt(); while(ser.GetBytesLeft()) checksum += ser.PopUnsignedChar(); return checksum; }