Answer the question
In order to leave comments, you need to log in
How to get a random value from a vector?
There is such a vector, you need to randomize something like this vector[random]; where random from [0,vectordrum.size()]; so that it does not go beyond the vector values.
vector<string>vectordrum;
vectordrum.push_back("str1");
vectordrum.push_back("str2");
vectordrum.push_back("str3");
vectordrum.push_back("str4");
int min=0,max=vectordrum.size(),random;
srand(time(0));
for(int__ i=0;i<countdrums;i++)
{
glPushMatrix();
glRotatef(rotate[i],1,0,0);
for(int__ j=0;j<counttextureondrums;j++)
{
random = ((int__)((float__)rand() / RAND_MAX*(max_ - min_) + min_));
glBindTexture(GL_TEXTURE_2D,/*GetTexture(drum[i][j]-4)*/image->IndexTexture[FindTexture(vectordrum[random]/*"auto4"*/)]);
EnableTexture(i,j);
}
glPopMatrix();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question