PDA

View Full Version : Random value?



lucas92
09-18-2008, 09:25 PM
I can't find the documentation on this... A random value would be quite useful.
It would be like on a calculator: rand int (1,10->A
So A would take a value between 1 and 10... It would be useful for scripts...

Pielord
09-18-2008, 10:17 PM
If I remember correctly it's something like:
int A = rand(1-10)
or something.

Joe123
09-19-2008, 06:16 AM
int A = Rand(10)+1;

Rand(10) picks a random integer value from 0 to 9.

ShadowTiger
09-19-2008, 10:31 AM
I'm sorry, refresh my memory; why does it need a +1? Is that so it escapes the 0-9 range and goes from 1-10?

_L_
09-19-2008, 11:43 AM
Yes, exactly.