I recommend using a grid system/array. Off the top of my head, I think the simplest way would be set a loop to pick a random grid (array) coordinate, check if it is next to an existing square, check to see if it is empty, then place the new block (empty=0, filled=1). If it fails the checks it will loop back to check a new random square.
Of course this isn't the most efficient method, and it might or might not get laggy depending on how big your grid is. Have the event fire off every second (all the looping and random picking happens effectively instantaneously).
Aleternativly by adding a few steps, you can pick a random array element that was previously filled (compare at x,y > 0), and check from there to see if any adjacent element is available (=0).