For simplicity, let's keep the walls and paths the same width, 1 block. Your maze path will by X by Y. When you add in the thickness of the walls, it will be 2X+1 by 2Y+1. To make other parts of the algorithm simpler, assume a hollow border around the maze, making your array 2X+3 by 2Y+3. Start by filling in the maze with 'X'

For a 4x4 maze:
`------------- ' '--Clear '#'--Set`
`| |`
`| ######### | 1. Make array M[A,B] [0,0] will be considered
upper left`
`| ######### | where A is from 0 ... 2X+2,
and B is 0 ... 2Y+2`
`| ######### | `
`| ######### | 2. Clear the edge of the array,`
`| ######### | but set the inside as pictured
to the left.`
`| ######### |`
`| ######### | 3. Start at 2,2 (actually you can be
random, but...)`
`| ######### |`
`| ######### | 4. Clear the current point`
`| |`
`------------- 5. Pick a random point that is 'set' 2 points
away (either`
`------------- horizontally or virtically).
If no such point, then`
`| |
backtrack to the previous old point and repeat step 5.`
`| ######### |`
`| # ##### | 6. Clear the point between the new
point and the old point.`
`| ######### | Also save the old point for
when the program must backtrack.`
`| ######### | You can save the point either
recursively, or in an array,`
`| ######### | etc...`
`| ######### |`
`| ######### | 7. Goto step 4`
`| ######### | The program finishes after step 5 needs to
backtrack, but has`
`| ######### | no saved points left to backtrack to...
The second picture to`
`| |
the left is (one of two possible views) after the second`
`------------- itteration through step 4.`
`-------------`
`| |`
`| ######### |`
`| # # # |`
`| ### ### # | `
`| ### # | One possible result the
first time step 5 needs to backtrack.`
`| ######### | Notice it will have to backtrack twice in a
row...`
`| ######### |`
`| ######### |`
`| ######### |`
`| ######### |`
`| |`
`-------------`
`-------------`
`| |`
`| ######### |`
`| # # # |`
`| ### ### # | `
`| # # # | Possible final maze...`
`| # ##### # |`
`| # # # |`
`| # ### ### |`
`| # # |`
`| ######### |`
`| |`
`-------------``
`

Oh, at the end you can just place a start and exit point anywhere (or
always at the same locations). There will be exactly one path from
any two points on the maze.