Game Development Community

Functions inside loops don't seem to work?

by Danilo Buendia · in Torque X 2D · 10/25/2009 (4:46 am) · 1 replies

I'm trying to run a function in a loop in another function, but it only seems to work for the first iteration.


In this example, the AdvancedRandom() only works on the first iteration.

string targetword = "01";

for (int x = 0; x < 8; x++)
{
     tempLetter = AdvancedRandom();
     tempword = String.Concat(targetword , tempLetter);
     targetword = tempword;          
}

ANy clues?

#1
10/25/2009 (5:03 pm)
What does your AdvancedRandom() look like?

Are you sure it is only calling it once?
Because with that for loop it will be called 8 times really fast.