All I need to do is generate a random integer between 0 and 3 for example. I am using this function:
void Crossover(int parents[2][3])
{
int ranDpart;
int ranDparent;
for(int i=0; i<10; i++)
{
for(int j=0; i<3; j++)
{
ranDpart = random(0,3);
ranDparent = random(0,2);
newGen[i][j] = parents[ranDparent][ranDpart];
}
}
}
where as you see parents is input with size of 2x3 and newGen
is 10x3 2D array. As seen here in the code, this function is supposed to randomly take one of parent and a part of this parent to make a new "child". Am I doing something wrong? I think that random gives me bad results. I tried some online compiler and random gives me numbers like "1804289383
" even if I tried to make it long. Can you guys help me with random int
?