Game Development Community

Getting a Random Integer Between a Range of Values

by Benster · in Torque 3D Professional · 10/28/2009 (2:38 pm) · 5 replies

What is a good way to get a random integer between 1 and 10 using TorqueScript (though I'm not opposed to using C++)? I'll be using the returned value for player movement on a path.

#1
10/28/2009 (3:14 pm)
getRandom(1,10);
#2
10/28/2009 (3:16 pm)
Thanks Ryan. Boy do I feel sheepish. :)
#3
11/03/2009 (10:05 am)
If you use Torsion and "build exports" you get a handy list of all ConsoleFunctions that you can incrementally search through and autocomplete while typing them.
#4
11/03/2009 (11:22 am)
there is also dumpConsoleFunctions() in the engine itself. or there was in TGE.
#5
11/03/2009 (11:29 am)
Yeah, that is actually what Torsion uses when you build exports.