i need to generate a map with randomly placed walls.. and AI monsters are placed inside roaming the map.

I need to make sure those monsters will not be stuck inside a wall. According to my lecturer, he recommends the use of something called Binary Tree. I understand how to use it but I don't know how to implement it in this game. I need to make sure that no monsters will be blocked by walls.. and the monsters for sure will be able to get out of the map.

any idea?
thanx