Generating indices for a triangle grid

Hello all. I’m trying to make a simple, flat grid of triangles, similar to the example image (ignore the random mountain!)…

I’m doing this with GL_TRIANGLES, rather than triangle strips, as I understand generally an indexed list of triangles is better for many reasons.

I’ve been searching the Internet high and low however for some help in automatically generating indices and thus populating a index list for the VAO. I understand the general concept and can sketch out what I need to do one paper etc without issue, I just can’t identify a pattern which would allow me to create an algorithm to do this for me.

I would be really grateful if someone could point me in the right direction. Thank you very much.