Random platform Generator

Hello, Im trying to create a random platform generator on which a character is supposed to jump higher and higher up on. but whenever i generate my map some platforms are further away or too close for a possible jump. Im wondering if anybody can help me with this

Here is my code:

public GameObject platform;

// calls on initiation
void Start()

// Random map builder
void RandomMapBuilder()

    // Spawn spawns for zone 1
    for (int i = 0; i < 20; i++)
        // Creates positions for all the ground/ platforms to spawn
        Vector3 SpawnPosition = new Vector3(Random.Range(-10, 10), Random.Range(0, 100), 0);
        Instantiate(platform, SpawnPosition, Quaternion.identity);

When you are placing your platforms you need to keep in mind how high your player unit can jump. What it seems like here is that you need a very specific random range, instead of applying the random directly to the position you should add it onto the last platforms position so it turns out to be newplatform.transform.position(randY+lastPlatform.y) etc

This means your platforms will stay a fairly consistent height from one another