  We give a new proof of the Frankl-R\"odl theorem on forbidden intersections,
via the probabilistic method of dependent random choice. Our method extends to
codes with forbidden distances, where over large alphabets our bound is
significantly better than that obtained by Frankl and R\"odl. We also apply our
bound to a question of Ellis on sets of permutations with forbidden distances,
and to establish a weak form of a conjecture of Alon, Shpilka and Umans on
sunflowers.
