Game Development Community

Random number

by Harrison Brock · in Technical Issues · 11/14/2005 (11:18 am) · 2 replies

Can you call a Random number in torque Script? Or would I need to use C++ for call a random number?

#1
11/14/2005 (1:07 pm)
Yes, for example; in TorqueScript:
%randNum = getRandom(2);
would generate a random number between 0-2, I used this for appending an index number to a sequence "name" to select a sequence to playThread()
%randNum = getRandom(1,2);
would generate a random number between 1 & 2, the resulting value would be stuffed into the %randNum variable for each bit of code. The first argument is the lower value and the second; the upper.

I believe, if no first argument is supplied, Zero is implied.

This is coming from an artist, ahem. Someone may correct this or elaborate...
#2
11/14/2005 (6:07 pm)
Thank you Rex