Fix nondeterministic failures in approx_distinct tests