  We show that for each $r\ge 4$, in a density range extending up to, and
slightly beyond, the threshold for a $K_r$-factor, the copies of $K_r$ in the
random graph $G(n,p)$ are randomly distributed, in the (one-sided) sense that
the hypergraph that they form contains a copy of a binomial random hypergraph
with almost exactly the right density. Thus Jeff Kahn's recent asymptotically
sharp bound for the threshold in Shamir's hypergraph matching problem implies a
corresponding bound for the threshold for $G(n,p)$ to contain a $K_r$-factor.
The case $r=3$ is more difficult, and has been settled by Annika Heckel. We
also prove a corresponding result for $K_r^{(t)}$-factors in random $t$-uniform
hypergraphs, as well as (in some cases weaker) generalizations replacing $K_r$
by certain other (hyper)graphs.
