Random numbers please help

How can I set a value to an int var by random?

I mean if I have a variable called “numbercount” and I want to give it a value from 1-5 for exapmle, how can I do it?

Random.Range(1,5)

returns a random int from ONE to FOUR

DON’T FORGET, with integers it is ONE LESS THAN THE LAST ONE.

Thus, Random.Range(0,10) will give you “ten different” random numbers (that is, 0 through 9 inclusive).

To “roll a dice” it would be Random.Range(1,7).

it’s ALWAYS one less than the end number you supply in the brackets. (the reason for this is to do with working with arrays. If you don’t understand this yet, don’t worry about it. Just don’t forget it’s one less than the end number.)