There is another algorithm.. The one which involves random division.

Basically, given an M x N matrix

________________________
|...............................................|
|...............................................|
|...............................................|
|...............................................|
|...............................................|
|...............................................|
|...............................................|
|...............................................|
|...............................................|
|...............................................|
|...............................................|

Draw a random line intersecting the maze vertically, then draw another
random line intersecting it horizontally.

________________________
|.............|.................................|
|.............|.................................|
|.............|.................................|
|.............|.................................|
|______.|________________.|
|.............|.................................|
|.............|.................................|
|.............|.................................|
|.............|.................................|
|.............|.................................|
|.............|.................................|

Now since you've got a 'plus' like formation of the two new lines, create
an opening on each of the new intersecting lines, one on each side of the
intersect


________________________
|.............|.................................|
|.............|.................................|
|...............................................|
|..............|................................|
|__....___|_______......______|
|.............|.................................|
|.............|.................................|
|.............|.................................|
|...............................................|
|.............|.................................|
|.............|.................................|

Now you've got 4 new matrices, recursively go ahead drawing more
intersecting lines on them such that the new ones don't have one end point
in the open.

Regards


On Wed, Jan 30, 2013 at 8:19 PM, Don <dondod...@gmail.com> wrote:

> It is George Marsaglia's multiply with carry pseudo-random number
> generator. It has a period of 2^32, which is long enough for this
> purpose. It is about as good as a 32-bit rng can be. In real life I
> use the Mersenne Twister, but I wanted something simple to include
> here.
>
> Don
>
> On Jan 29, 11:46 pm, Piyush Grover <piyush4u.iit...@gmail.com> wrote:
> > @Don can you give the logic of your rnd() function?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to algogeeks+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>


-- 
Anup Ghatage
www.ghatage.com

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to