This approach is looping through the whole tilemap and repeatedly setting sprite positions to the most recently discovered empty tile, over and over until it reaches the last tile.
To randomize it, instead of setting the sprite's position when you find an empty tile, store the loopindex(x) and loopindex(y) in an array. Then when this is done, you'll have a list of empty tile coordinates to choose from.
Picking a random entry in the array will give you a random empty tile, which you can use to set the sprite's coordinates.
(To do this repeatedly, delete the coordinates from the array as you go.)