
/*
R
G -> 0,255
B
*/

//alfabet = "??????????????"

function getRandomGreen()
{

	return Math.floor(Math.random()*256) ;
	//document.write(Math.floor(Math.random()*));
	//document.write(Math.floor(Math.random()*));
}

function getRandomChar()
{
	//return Math.Random(0,128)
	//return Math.floor(Math.random()*128);
	//380-640
	
	return  "&#" + (400 + Math.floor(Math.random()*(47)) )+  ";" ;
	
}

function getChar(posX,posY,white)
{
	newChar = getRandomChar();
	//newChar = "0";
	//newChar = "&#643;";
	newGreen = getRandomGreen();
		
	v = 	Math.floor(Math.random()*100);
	
	//alert(v);
	
	if(white==1)
		return "<span style='color:rgb(255,255,255); font-weight:bold;' >" +newChar  +"</span>";
	else 
		return "<span style='color:rgb(0,"+ newGreen + ",0)' >" +newChar  +"</span>";
}


function print(str)
{
	document.write(str);
	//alert ("document.write("+str+");");
}

matrixString = "";

width = 1024;
height = 768;

//charinpixel 14x20 = 480px^2

pixelWidth = 14
pixelHeight= 20
//1024x768= 786432px^2 
prob=50;

hChars = width / pixelWidth 


vChars = height / pixelHeight 

///alert(hChars + " , " + vChars );

//alert(0);

flag=true;


for (j=0;j<vChars;j++)
{
	flag=true;
	matrixString  += "<p>";	
	
	for (i=0;i<hChars && flag;i++)			
	{
		v = Math.floor(Math.random()*500);
		
		if (v==prob)
		{
			matrixString  += getChar(i,j,1) + " ";		
			//j=vChars;			
			flag=false;
		}
		else
			matrixString  += getChar(i,j,0) + " ";		
		//matrixString  += "000";
	}
		
	matrixString  += "</p>";
}
		
print (matrixString);
//print (000);


