Procedural generation of a dungeon?

Hello all,
Here is my first attempt at coding a roguelike sort of game: https://gist.github.com/TheSolderKing/381a832b0b292024c857
The mechanics are simple enough. The player controls the pink square to move throughout the generated dungeon. There are no enemies, just simply a dungeon, which makes it more of a test than a real game. My question concerns the procedural generation, however. This cannot be the correct way to do it, can it? I generate 2 rooms(actually 3, but one is an extra passage that is not needed and is only 1x1 so is not really a room) and draw passageways between them. Is there a better way? If so, could you provide me with an example of procedural generation done correctly, because I have read all the tutorials and I still cannot get the hang of it. I know it is asking a lot, but help would be greatly appreciated. Thank you,
-TheSolderKing

@TheSoldierKing: If you head over to the Codea Community, I have a Roguelike Tutorial conversion I’m working on (the original is here: http://www.roguebasin.com/index.php?title=Complete_Roguelike_Tutorial,_using_python%2Blibtcod). I completely forgot to back it up, so it’s brand new today. It has a basic map generator, along with generating o’s and T’s, though no AI yet. It’s also not even remotely optimized.

I’m working through the FOV code located here: https://github.com/markandgo/Lua-FOV amongst other projects.

Thank you @athros! I have always loved roguebasin. I also foud an algorithm somewhere else that I implemented called drunkard’s walk. Not the most complex, but it works well for me. Thanks again!

Now if only I could get the hang of pathfinding…

From the @Ignatz library:

https://coolcodea.wordpress.com/2013/04/10/29-using-a-to-solve-a-maze/