Why are the results of RNG same every time?
Hello. I have a problem about RNG class. I want to get different point randomly from a given image, so I use the RNG class which is recommanded in the OpenCV document. The code is:
struct SingleAnt
{
int row;
int col;
};
void initializeAnts( SingleAnt *ants, Mat *sourceImage )
{
RNG rng( 0xFFFFFFFF );
int imgWidth = sourceImage->cols;
int imgHight = sourceImage->rows;
for( int index = 0; index < ANTSNUMBER; index++ ) {
ants[ index ].col = rng.uniform( 0, imgWidth );
ants[ index ].row = rng.uniform( 0, imgHight );
}
}
But whenever I run this code, I get the same result. Are there any mistakes in the code? Thanks!