This paper studies a principal-agent problem of moral hazard, in which the outside option is stochastic. This renders the agent's participation decision random from the perspective of the principal. The participation cost is no longer defined in terms of the agent's outside option but in terms of the principal's marginal benefit of participation. The optimal contract (i) entails information rents; (ii) features a trade-off between participation probability and rents and (iii) induces a lower effort than the standard model. Random participation results in weaker incentives and in twofold (ex ante) welfare losses. Menus of contracts (screening mechanisms) are not helpful to extract information because the single-crossing condition does not hold.