jeudi 2 juin 2016

Random Function creating same numbers in C++

void player_info::random_addition()
{
    assign:
    int *a=new int;
    int *b=new int;
    int x, y;
    randomize();
    *a=random(size-1);
    *b=random(size-1);
    x=*a;
    y=*b;
    if (array[x][y]==0)
    {
        array[x][y]=2;
    }
    else
    {
        goto assign;
    }
    delete a;
    delete b;
}




Aucun commentaire:

Enregistrer un commentaire