Random(0,2) gives bad results
stdlib.h defines a few psuedo-random number functions. I am not familiar with a random function taking two arguments, presumably the low and high end of the desired range, that you've specified in your code.

For what it's worth, in plain old C use the modulo operator to achieve the range you want using stdlib's srand and rand functions:

/* seed psuedo-random number generator during setup with something */
srand(0xdeadbeef);


and in your function simply use modulus to get your range:

int ranDpart = rand() % 3; /* range: 0,1,2 */
int ranDparent = rand() % 2; /* range: 0,1 */


If your ranges should be inclusive e.g. [0,3] and [0,2] then

int ranDpart = rand() % 4; /* 0,1,2,3 */
int ranDparent = rand() % 3; /* 0,1,2 */