How can I pick a random wall tile?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By bobbydickins
:warning: Old Version Published before Godot 3 was released.

I am using the Rect2 type to carve out rooms from my “map” which is just a large array.

I would like to be able to pick out a random wall tile every time I create a new room.

Before the actual spot is selected I have my map generator pick a random direction to go in (up down left or right) and based on this direction i pick a random wall tile to create a door from. For example, if the random direction is “UP” I would pick a random tile from the top wall of the previous room/Rect2 (which is stored in an array called “rooms”).

Is there any way to do this using the Rect2 type?