I just finished a random dungeon generator. It produces an array containing the X and Y coordinates, the tile type (path, wall, start or end) and tile graphic information of the dungeon.
The random dungeon generation is quite easy. It walks from a starting position until a predetermined number of tiles have been placed and a minimum distance from the starting position has been reached
The tile graphic part is solved by using prime numbers to create unique ID:s for different tile combinations. I did this in a separate editor, which is also included in the example.
It might not be the most intuitive example ever (far from, I guess), but I hope it's useful nonetheless!
The example can be found here: http://www.declared.se/?p=84