1 of 4

JavaScript (ES6), 80 bytes

Empty slots are _, mines are 7.

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

Try it online!