how to internally calculate random number....i am implementing game like braintuner2.

now suppose for example 2 + 3 = 6 (2,3,6 numbers are generated randomly…)i wil be using two GUIBUTTON one for right and other for wrong…now internally i should calculate answer for 2 + 3 = 5…and depending upon user pressing right or wrong button…if user presses wrong button for above example then my game should display next number…BUT MY POINT IS HW TO CALACULATE original answer internally…here is code…

#pragma strict

var rand:int;

function Start()

{


rand = Random.Range(0, 10);

}

function OnGUI()
{


//var rand:int; 
//rand = Random.Range(0, 10);
//GUI.Label(Rect(20,20,100,30),rand.ToString());
GUI.Box (Rect (30,5,25,30), rand.ToString());//first random number
Debug.Log(rand);
GUI.Box (Rect (60,5,25,30),"+");//for +symbol

GUI.Box (Rect (120,5,25,30),"=");//for equals to



//var inter : int;

}

If you’re displaying the two numbers to be added, you then have those numbers. Just sum them together in your code and compare them to the random answer. If they’re the same, right it the answer, if they’re different wrong is the answer.

can u help me with code…plz…and these are random numbers…

you generated random numbers. So you have them. Just add them. (though I don’t see where you generated the numbers for adding, only generated the possible answer. Your code you posted is way incomplete)

I’m not going to write this code for you, I’m doing you NO favor by doing that, but instead a dis-service as you’ll still not know how to code it yourself.

thnx alot lordofduct… Done with it by using urs logic…