Random sudoku generation 
I'm writing a function that should generate random sudoku puzzles for a simulation project; this funcion takes as argoument the number of cells to generate then it generates the indexes of cells and numbers to put in those cells. 
I have a problem in generation of cells indexes, I'm not an expert in programming and i can't find a good routine to generate indexes and to check out not to be the same index couple two times or more. The funcion is:

        void gen_puzzle(int quanti)
    {
        if(quanti>81) exit(1);
        indici* ij=new indici[quanti];
        int f,g,k, controllo=1;
    
    
        do
        {
    
    
        #pragma omp parallel for
        for(f=0; f<9; f++)
         for(g=0; g<9; g++)
         {
         puzzle[f][g].num=0;//azzera il sudoku
         puzzle[f][g].p=0;
         }
    
    //////////////section to improve
    out:
        srand(int(time(0)+clock()));
    
        #pragma omp parallel for
        for(k=0; k<quanti; k++)
         ij[k].i=casuale()-1, ij[k].j=casuale()-1;//genera le celle da riempire casualmente
    
    
        for(f=0; f<quanti; f++)
         for(g=f+1; g<quanti; g++)
        {
         if(ij[f].i==ij[g].i && (ij[f].j==ij[g].j)) goto out;
    
        }
    ////////////////////
    
    
        #pragma omp parallel for
        for(k=0; k<quanti; k++)
         puzzle[ij[k].i][ij[k].j] . num=casuale();//riempie le celle casualmente
        }
        while(datiNonAccettabili()); //fino a quando il sudoku non è buono
    }
I ask help for section where the funcion puts random indexes in ij[] array, i used a "goto" but it's not a good solution and it doesn't work well if "quanti" is bigger then 17 about.
"casuale()" just returns a random number between 1 and 9.
Thanks for help me improving this section.
Random sudoku generation 
===

I'm writing a function that should generate random sudoku puzzles for a simulation project; this funcion takes as argoument the number of cells to generate then it generates the indexes of cells and numbers to put in those cells. 
I have a problem in generation of cells indexes, I'm not an expert in programming and i can't find a good routine to generate indexes and to check out not to be the same index couple two times or more. The funcion is:

        void gen_puzzle(int quanti)
    {
        if(quanti>81) exit(1);
        indici* ij=new indici[quanti];
        int f,g,k, controllo=1;
    
    
        do
        {
    
    
        #pragma omp parallel for
        for(f=0; f<9; f++)
         for(g=0; g<9; g++)
         {
         puzzle[f][g].num=0;//azzera il sudoku
         puzzle[f][g].p=0;
         }
    
    //////////////section to improve
    out:
        srand(int(time(0)+clock()));
    
        #pragma omp parallel for
        for(k=0; k<quanti; k++)
         ij[k].i=casuale()-1, ij[k].j=casuale()-1;//genera le celle da riempire casualmente
    
    
        for(f=0; f<quanti; f++)
         for(g=f+1; g<quanti; g++)
        {
         if(ij[f].i==ij[g].i && (ij[f].j==ij[g].j)) goto out;
    
        }
    ////////////////////
    
    
        #pragma omp parallel for
        for(k=0; k<quanti; k++)
         puzzle[ij[k].i][ij[k].j] . num=casuale();//riempie le celle casualmente
        }
        while(datiNonAccettabili()); //fino a quando il sudoku non è buono
    }
I ask help for section where the funcion puts random indexes in ij[] array, i used a "goto" but it's not a good solution and it doesn't work well if "quanti" is bigger then 17 about.
"casuale()" just returns a random number between 1 and 9.
Thanks for help me improving this section.