We show that the promise problem of distinguishing n-bit strings of relative Hamming weight 1/2 + Ω(1/ lg d−1 n) from strings of weight 1/2 − Ω(1/ lg d−1 n) can be solved by explicit, randomized (unbounded fan-in) poly(n)-size depth-d circuits with error ≤ 1/3, but cannot be solved by deterministic poly(n)-size depth-(d + 1) circuits, for every d ≥ 2; and the depth of both is tight. Our bounds match Ajtai's simulation of randomized depth-d circuits by deterministic depth-(d + 2) circuits (Ann. Pure Appl. Logic; '83), and provide an example where randomization buys resources.To rule out deterministic circuits we combine Håstad's switching lemma with an earlier depth-3 lower bound by the author (Comp. Complexity 2009).To exhibit randomized circuits we combine recent analyses by Amano (ICALP '09) and Brody and Verbin (FOCS '10) with derandomization. To make these circuits explicit we construct a new, simple pseudorandom generator that fools tests, |A i | = n/2 with error 1/n and seed length O(lg n), improving on the seed length Ω(lg n lg lg n) of previous constructions.