We present an improved AKS condition for the random AKS algorithm, where is the number of congruences to be tested, the degree of the modulo polynomial and the multiplicative order of modulo . It is based on Bernstein's result and better than his condition when ; this improved condition enables us to choose a smaller : theoretically by a factor () and numerically and for most practical cases; and thus improves time and space complexities.