Basically this function is called when I get to a fight screen and it determines the Number of Mobs and for the Number of mobs picks a random set of mobs from the 1-6 range(TypeOfMob).
So far i can get it to return, but it is returning the same types always. Like if there is 4 mobs and it ends up with 4 of the same type, I want it to be random, not all the same.
#include "stdafx.h"#include <iostream>#include <time.h>using namespace std;int* pType;int NumOfMobs(){ int i=0; srand(time(NULL)); i=(rand()%3)+1; return i;}int TypeOfMob(){ int i=0; srand(time(NULL)); i=(rand()%6)+1; return i;}int _tmain(int argc, _TCHAR* argv[]){ int num= NumOfMobs(); pType= new int[num]; pType[0]=TypeOfMob(); pType[1]=TypeOfMob(); pType[2]=TypeOfMob();//etc cout << NumOfMobs() <<"\n" <<pType[0] <<"\n" <<pType[1]<<"\n" <<pType[2]<<"\n" <<pType[3]<<"\n" <<pType[4]<<"\n" <<pType[5]; cin.ignore(); return 0;}