Hmm, you may have problems if you do not (or cannot import) Slash :: Test. From the "vanilla" TT installation, you can simply use the Math plugin:
USE Math; GET Math.rand;
See this link in the template toolkit manual for more information on the Math plugin and various methods.
Update: Math.rand requires an option. Therefore, to get a random number from 0 to 1, use:
GET Math.rand(1);
Angelos
source share