The probability vector obtained by the measurePeriod function most likely has a non-zero value at |0...0> which is not usable. In that case, the findPeriod function will try again from scratch, but we can actually reuse the existing probability vector.