var playTable = new Array();

for ( var row = 0 ; row < 4 ; row++) {

    playTable[row] = new Array();
    for ( var col = 0 ; col < 4; col++) {
        playTable[row][col]=0;
    }
}

var rowPosit, colPosit, playElementValue, sorted = 0;

for( var elementCount = 0 ; elementCount < 8 ; elementCount++) {
    do {
        rowPosit = Math.floor((Math.random() * 4) + 1) - 1;
        colPosit = Math.floor((Math.random() * 4) + 1) - 1;
    } while ( playTable[rowPosit][colPosit] == 0 );


    do {

        sorted = 0;
        playElementValue = Math.floor((Math.random() * 4) + 1);


        for ( row = rowPosit, col = 0 ; col < 4 ; col++) {
            if( playTable[row][col] == playElementValue && row != rowPosit && col != colPosit ) {
                sorted = 1;
            }
        }

        for ( col = colPosit, row = 0 ; row < 4 ; row++) {
            if( playTable[row][col] == playElementValue && row != rowPosit && col != colPosit) {
                sorted = 1;
            }
        }

        for ( )

    } while( sorted = 1 );

    playTable[rowPosit][colPosit] = playElementValue;

}

@@ -573,24 +573,97 @@
 * 4) + 1);%0A%0A
+        // check if the randow generated number is NOT in the row already
 %0A        for
@@ -850,34 +850,130 @@
       %7D%0A        
-%7D%0A
+    continue;%0A        %7D%0A%0A        // check if the randow generated number is NOT in the col already
 %0A        for ( c
@@ -1167,26 +1167,1652 @@
     
-%7D%0A%0A        for ( )
+    continue;%0A        %7D%0A%0A        //4 checks for each 2x2 block in the 4x4 playtable - check if the number is already there%0A        if( rowPosit %3C= 1 && colPosit %3C=1 ) %7B%0A            for ( row = 0 ; row %3C 2 ; row++) %7B%0A                for( col = 0 ; col %3C 2 ; col++ ) %7B%0A                    if (playTable%5Brow%5D%5Bcol%5D == playElementValue && row != rowPosit && col != colPosit) %7B%0A                        sorted = 1;%0A                    %7D%0A                    continue;%0A                %7D%0A            %7D%0A        %7D%0A%0A        if( rowPosit %3C= 1 && colPosit %3C= 3 ) %7B%0A            for ( row = 0 ; row %3C 2 ; row++) %7B%0A                for( col = 2 ; col %3C 4 ; col++ ) %7B%0A                    if (playTable%5Brow%5D%5Bcol%5D == playElementValue && row != rowPosit && col != colPosit) %7B%0A                        sorted = 1;%0A                    %7D%0A                    continue;%0A                %7D%0A            %7D%0A        %7D%0A%0A        if( rowPosit %3C= 3 && colPosit %3C= 1 ) %7B%0A            for ( row = 2 ; row %3C 4 ; row++) %7B%0A                for( col = 0 ; col %3C 2 ; col++ ) %7B%0A                    if (playTable%5Brow%5D%5Bcol%5D == playElementValue && row != rowPosit && col != colPosit) %7B%0A                        sorted = 1;%0A                    %7D%0A                    continue;%0A                %7D%0A            %7D%0A        %7D%0A%0A        if( rowPosit %3C= 3 && colPosit %3C= 3 ) %7B%0A            for ( row = 2 ; row %3C 4 ; row++) %7B%0A                for( col = 2 ; col %3C 4 ; col++ ) %7B%0A                    if (playTable%5Brow%5D%5Bcol%5D == playElementValue && row != rowPosit && col != colPosit) %7B%0A                        sorted = 1;%0A                    %7D%0A                    continue;%0A                %7D%0A            %7D%0A        %7D
 %0A%0A  
@@ -2891,11 +2891,12 @@
 tValue;%0A
-%0A
 %7D%0A
+%0A%0A

Update sudokuAlg.js