Brachylog, 8 bytes
ẉ?ℕ₁-₁ṙ↰
###Explanation
Explanation
ẉ Write the input followed by a linebreak
?ℕ₁ The input must be in [1, …, +∞)
-₁ṙ Generate an integer in [0, …, input - 1] uniformly at random
↰ Recursive call with that random integer as the new input
The recursion will stop once ?ℕ₁
fails, that is, when the input is 0
.