Using a large array is an option, it will provide persistence. Shifting the array is another option but you won't be able to use for each xy element. You'll need to set the array in a certain order depending on which direction you shift. For example shifting right:
for x from 32 to 0
for y from 0 to 32
-- set array(x,y) to array(x-1,y)
A third option that would provide for persistence and and infinite size would be to use or implement a random function that allows you to set the seed.
One example of this would be Perlin Noise