I have a situation where I need to fill a grid with tiles that will be of different sizes, but all multiples of a base unit size. Can anyone point me to an example of this already implemented, or some actionscript examples?

Here is a more detailed explanation of what I'm doing.
You would have a grid that is of n units wide by n units tall. Then tiles that are also n units wide by n units tall. I want to then give a function a random number of tiles to place into the grid, without having any tiles overlap. It will then place a tile at a random position on the grid, but not in any grid cells that have already been covered by a tile.

I have been searching google, but I can't seem to find anything that applies.

Thanks for any help.