I saw this here: https://gist.github.com/munificent/b1bcd969063da3e6c298be070a22b604
But it was in C so I converted it into JavaScript. First I used this tool: https://www.codeconvert.ai/c-to-javascript-converter
And then I had to make a few tweaks to get it to display a to the screen.
data:text/html,<title>Dungeon Gen</title><script>r='';R=n=>~~(Math.random()*n),H=40,W=80,m=Array.from({length:40},()=>Array(80).fill(' ')),V=r=>{let o=R(10)+5,e=R(6)+3,f=R(80-o-2)+1,n=R(40-e-2)+1;for(B=n-1;B<n+e+2;B++)for(a=f-1;a<f+o+2;a++)if('.'===m[B][a])return;let t,l,d=0;if(!r){for(i=n-1;i<n+e+2;i++)for(c=f-1;c<f+o+2;c++)(c<f||c>f+o)^(i<n||i>n+e)&&'%23'===m[i][c]&&0===R(++d)&&(t=c,l=i);if(0===d)return}for(h=n-1;h<n+e+2;h++)for(u=f-1;u<f+o+2;u++){let r=u<f||u>f+o,t=h<n||h>n+e;m[h][u]=r&&t?'!':r^t?'%23':'.'}for(d>0&&(m[l][t]=R(2)?`'`:'+'),g=0;g<(r?1:R(6)+1);g++)m[R(e)+n][R(o)+f]=r?'@':0===R(4)?'%24':String.fromCharCode(65+R(62))},onload=f=>{for(r='',e=0;e<1e3;e++)V(0===e);for(n=0;n<40;n++)for(t=0;t<80;t++){let o=m[n][t];r+='!'===o?'%23':o,79===t&&(r+='\n')}z.innerHTML=r}</script><pre id=z>Here's an example of what I generated:
############
#.....\....#
#..........#
################# #....N.....# ##########
#...$...........# #..........# #........##########
#...............# #...$......######## #........#x....u..#
#...............# ################ #..........#..$...# #....i.u.#[.......#
#...............# #j....y........# #..........+..|...# #..$.....#....$...#
#...............# #..............# ############......# #........#........#
#.......R.......# #..............# #......# #######'###+#######
#...............# #..............# #######+##### #.$....#
#...............# #..............# #....$....# #......#
###############+######'######################.........# #......#
#......g..# #p..J.....+N........# #..L...#
#.....c...# #.........#...._....###########.$....#
#.....k...# #.........#.........##....m...#......#
############.........# #.........############........'......#
#.$...T...##.........# #.........# #..$...s.####+#########
#y....{...##.........# #.........############^.......##..\........#
#....U....##....$..$.########## #.........#.......N..+........##...........#
#.........##.........'......W.# #.........+......K...###########$..j.......#
#########'##'#########........######+######..........# #...........#
#.......`...# #........#......# #....a.....# #############
#...........# #........#..@...# #..........# #...n......#
#.$.......A.# #........#......# #..........# #..x.......#
#...........# #a.......#......# #######+############# #..........#
#...........# #........+......# #...]...y......# #..........#
#################+######......# #..............# #...Q......#
#.............##......# #..............# #..........#
#.............###'########## #.........F....##########'###
#.............#..r.........# #..............#..........#
#.............#............# #..............'..........#
#################....]........#............# ###########'####..........#
#...............#.............#.$.....y....# #.............##[.....b...#
#..G.....Z...|..'.........L...#............# #.............##...$......#
#........c......#.............#............# #.............##..y.......#
#...............###############............# #_.$..........##..........#
#...............# ############## #.............##..........#
################# ###########################