I am having some issues when I try to fill an array with random values inside a class. I have a ten elements array and constructor initalizes them,
calling for function member sort()
MiniVector::MiniVector()
{
vectors=new int[10];
for (int i=0;i<10;i++)
{
vectors[i]=sort();
}
}
int MiniVector::sort()
{
srand(unsigned(time(NULL)));//seed for randomize
srand(time(0));
return rand()%100;
}
The problem is that sort() is filling array with same number. Any ideas?
So, where should I put it? I tried on constructor, now I have randomize numbers, but every time I run the program, I get the same randomize numbers(ssed is not working). I cannot put it on main.
Thanks