2 of 4 saved 2 bytes

JavaScript (ES6), 78 bytes

Empty slots are _, mines are 7.

f=(n,o=`___
_${k=n}_
___`.replace(/_/g,c=>Math.random()<.5?--k|7:c))=>k?f(n):o

Try it online!