Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The Problem is that your are initializing RNG always with the same value. Try this:

#include <time.h>
.
.

void initializeAnts( SingleAnt *ants, Mat *sourceImage )
{
    uint64 initValue = time(0);
    RNG rng( initValue );
    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 );
    }
}

This should give you different random values.