The script fills the grid with cells with random or fixed heights on every page load, and thus giving the widget a unique layout every time someone loads your page.
The grid is smart enough to prevent cells from being too big for the total size of the widget. At any point in time, there is no cell that is only partially shown or hidden. It just works.
Dynamic Grid: WP Photo Gallery is fully responsive!