An analogue of the Erdős–Gallai theorem for random graphs. (January 2021)