seems easy enough, granted i'm not absolutely sure what you mean by 'generating' .. applying that simple algo / operation to some array you have to get a new version / the data modified?
The array only needs to be generated once; i.e., the surface is generated once, then done. It doesn't have to be modified, just created.