I don't remember to be honest, but you can use browser dev-tools to find out - take a look at index.html and grid.js files - they are not minified or anything.
That being said I'd recommend you search for "dungeon generation algorithms" or "procedural dungeons howto" or something like that - reading my rubbish code's probably not worth your time.
Good luck!
-- edit: It's slightly different take but I love this method: https://web.archive.org/web/20140330181550/https://www.vlambeer.com/2013/04/02/r...