changed algorithm for grid fill with random elements;