  Many statistical mechanics problems can be framed in terms of random curves;
we consider a class of three-dimensional loop models that are prototypes for
such ensembles. The models show transitions between phases with infinite loops
and short-loop phases. We map them to $CP^{n-1}$ sigma models, where $n$ is the
loop fugacity. Using Monte Carlo simulations, we find continuous transitions
for $n=1,2,3$, and first order transitions for $n\geq 5$. The results are
relevant to line defects in random media, as well as to Anderson localization
and $(2+1)$-dimensional quantum magnets.
