Hey fellas!
rand() does not seem to be very good random number generator. Is there anything else available? Maybe some other function in C which I can use?
int i=0;
for(i=0;i<50;i++)
{
int rndm = rand(5);
sprintf(text, "%s, %i", text, rndm); //add the last random number to the whole string
}
schnellboot wrote:this might be a bit off topic
but I made a test actor to test rand()
test -> Create Actor -> Script Editor
- Code: Select all
int i=0;
for(i=0;i<50;i++)
{
int rndm = rand(5);
sprintf(text, "%s, %i", text, rndm); //add the last random number to the whole string
}
why doesn't this work?
int var = 0;
var = var++;
lverona wrote:I tried it out in an example such as rand(5). It very frequently gives the same value, like 2,2,2,2,2.
int i=0;
for(i=0;i<50;i++)
{
int rndm = rand(5);
sprintf(temp, "%s, %i", text, rndm); //add the last random number to the whole string
text = temp; //temp is a global string variable
}
schnellboot wrote:sky this still doesn't work
- Code: Select all
int i=0;
for(i=0;i<50;i++)
{
int rndm = rand(5);
sprintf(temp, "%s, %i", text, rndm); //add the last random number to the whole string
text = temp; //temp is a global string variable
}
int i;
char temp[255];
for(i=0;i<50;i++)
{
int random = rand(5);
sprintf(temp, "%s, %d", text, random);
strcpy(text, temp);
}
Users browsing this forum: No registered users and 1 guest