dimanche 29 mars 2015

tread 1 error - using rand()function

I have to select random number between 0 and 3. I have to call this function several times. In the beginning it's always working but after some time the error message "Tread 1: EXC_BAD_ACCESS(code =2, address 0x7fff5f3ffff8" appears.


Here is my code. m_p[multiproject][project] is equal to 4;



int selecteer_random_resource(int multiproject, int project)
{ int k=0;
k=rand()%m_p[multiproject][project];
return k;
}


I really don't understand why it's working in the beginning and after some time the error appears. Can somebody help me with this? Thanks in advance!





Aucun commentaire:

Enregistrer un commentaire