Im trying to generate a lot of objects that contain randomized sprite.
But it returns the same image on all object.
the random works, but all the 70 items always have the same image (second random always same with the first).
randomItem(Item* pItem)
srand(time(0));
switch((rand() % 10) + 1)
{
case 1 :
pItem->updateAll("Apple.png","Apple");
break;
case 2 :
pItem->updateAll("Basket1.png","Basket");
break;
//case ...
SOLVED
the srand(time(0)) should be called once, so I put it out the loop.