denote the new matrices by H ′ 0 and L ′ $_{0}$, respectively. 3) Compute the merit function m ( H ′ $_{0}$). 4) Randomly choose a set T = { t$_{1}$, · · · ,t$_{c}$ } . 5) Randomly generate the matrices A and B according to Theorem 5. 6) Apply a selection operator based on A and B , and obtain a new simplified logical matrix L ′ . 7) Randomly generate a matrix M$_{V}$ according to Theorem 3. 8) Apply the unitary row operator defined by M$_{V}$ to obtain a new simplified logical matrix L ′ . 9) Compute the minimum distance d of the EAQEC code defined by H ′ and L ′ . 10) Compute the merit function m ( H ′ ). 11) If m ( H ′ ) < m ( H ′ $_{0}$), set H ′ 0 ←− H ′ . 12) If d = b = ⌊ n + $^{c}$−$^{k}$− 2 2 ⌋ , or the search has repeated more than a maximum number of times, stop. 13) Else, Go to step 4). Since the minimum distance might not be the best measure of the error-correcting ability of a quantum error-correcting code, a different merit function can be adopted. Here we simply chose the merit function m () to encourage EAQEC codes with fewer low-weight elements in N ( S ′ ) − S ′ $_{I}$. Some examples of this random search algorithm follow: Example 6. Applying the random search algorithm to the [[7 , 1 , 3]] quantum BCH code and Shor’s [[9 , 1 , 3]] code, we obtain the same results as those in Table 3 and Table 4 by the complete encoding optimization procedure. We list in Table 5 and Table 6 the average 31