Holes in generated level

Here is what I have currently:

http://dl.dropbox.com/u/43867531/Dungeon%20Escape/WebPlayer/WebPlayer.html

Here is the script:

var currentBlock : GameObject;

var Lava	  	 : GameObject;

var Stone	   	 : GameObject;



var randomMax : int = 150;

var difficulty : int = 150;



var generatedInt : int;

var generatedInt2 : int;



var player	   : GameObject;



var lastBlockX : GameObject;



function Start ()

{

	yield StartCoroutine("GenerateNumbers");

}



function Update ()

{



	if(Vector3.Distance(player.transform.position, lastBlockX.transform.position) < 5)

	{

	Generate();

	}

	

	print ( generatedInt );

	

	

}



function Generate ()

{

	



	var nextPosX : Vector3 = new Vector3(lastBlockX.transform.position.x + 0.5, lastBlockX.transform.position.y,lastBlockX.transform.position.z);	

	newBlockX = Instantiate(currentBlock, nextPosX, lastBlockX.transform.rotation);

	

	lastBlockX = newBlockX;

	

	if ( generatedInt <= difficulty )

	{

		currentBlock = Lava;

	}

	if ( generatedInt >= difficulty )

	{

		currentBlock = Stone;

	}

	

		

}



function GenerateNumbers ()

{

	

	while(true)

	{

		yield WaitForSeconds(0.25);

		generatedInt = Random.Range(0,randomMax);

	}

	

}

Anyways, The orange blocks are lava. I am trying to get it to generate lava randomly, but it is generating them in strings that are too long. How would I solve this?

I seem to have figured it out, I just made an int that counted how many lava blocks there were and then if there was over 4 it just changed it to a stone block.

But I still have another issue, if you hit play you notice that at the very start there is a hole. I didn’t code this in, its still the same code as above. I am not sure why it’s doing this.

It could possibly be because your variables do not have a value when declared:

var generatedInt : int;
var generatedInt2 : int;

Maybe if you made sure they started at difficulty+1 you would not get the hole.