• # Thread: Difficult programming/logic question

1. ## Difficult programming/logic question

So I'm trying to develop a randomly generated terrain using vertices and then making a surface out of them connecting triangles(2) to make a solid 4 cornered piece of land.
My logic is confusing me and then derailing my train of thought.
I'm looking for a less complicated way of approaching this.

Here's my style

size = 30
name[500]

For(x=0;x<size;x++){
For(z=0;z<size;x++){
y=y-(rand(-1,1))
}
}

The result is not what I want nor what I can work with to create bigger lands if the y value for the x(1) goes down and the x(2) goes upwards.

I thought of another way but this would require an array inside an array so I could grab each any every point/vertex then comparing it to the one that will be next to it to keep the ground within a -1 through 1 point of the last; leaving the code a mess.
I drew a image to make it clear in my head. result;

coding this would be a pain in the ass and be hard to work with if I wanted to modify.

Anyone have a better way of doing this, I have all the coding down and drawings already set up.
I just want to know how I would randomize the Y axis but still create a realistic texture, similar to minecraft style of generation.