This Python 3 script is roughly based on the dungeon creation tool provided in the free edition of Worlds Without Number, p. 234 ff
The script will generate a random dungeon in Mermaid syntax, which can then easily be edited or converted to a map with a Mermaid editor such as Mermaid Live Editor
Which gives something like: