Hello, I have no idea why this is happening, but the computer is assigning incorrect values in my loop:

The output for this code is:byte ran; for(short y=0;y<yt;y++){ for(short x=0;x<xt;x++){ // if(y==0&&x==0){ ran=(byte)(6*Math.random()); System.out.println("ran: "+ran); if(ran==0)ta[0][0]=0; if(ran==1)ta[0][0]=12; if(ran==2)ta[0][0]=51; else ta[0][0]=30; } // if(y==0&&x>0){ if(ta[0][x-1]==1||ta[0][x-1]==13||ta[0][x-1]==30||ta[0][x-1]==50){//s ran=(byte)(6*Math.random()); System.out.println("ran: "+ran); if(ran==0)ta[0][x]=0; if(ran==1)ta[0][x]=12; if(ran==2)ta[0][x]=51; else ta[0][x]=30; System.out.println("ta["+y+"]["+x+"]="+ta[0][x]); } if(ta[0][x-1]==0||ta[0][x-1]==5||ta[0][x-1]==10){//s-hm ran=(byte)(5*Math.random()); System.out.println("ran: "+ran); if(ran==0)ta[0][x]=1; if(ran==1)ta[0][x]=4; else ta[0][x]=10; System.out.println("ta["+y+"]["+x+"]="+ta[0][x]); } if(ta[0][x-1]==7||ta[0][x-1]==11||ta[0][x-1]==44){//hm-s ran=(byte)(5*Math.random()); System.out.println("ran: "+ran); if(ran==0)ta[0][x]=6; if(ran==1)ta[0][x]=45; else ta[0][x]=11; System.out.println("ta["+y+"]["+x+"]="+ta[0][x]); } if(ta[0][x-1]==4||ta[0][x-1]==8||ta[0][x-1]==12){//udm ran=(byte)(4*Math.random()); System.out.println("ran: "+ran); if(ran==0)ta[0][x]=7; if(ran==1)ta[0][x]=9; else ta[0][x]=34; System.out.println("ta["+y+"]["+x+"]="+ta[0][x]); } if(ta[0][x-1]==6||ta[0][x-1]==9||ta[0][x-1]==35){//ddm ran=(byte)(4*Math.random()); System.out.println("ran: "+ran); if(ran==0)ta[0][x]=5; if(ran==1)ta[0][x]=8; else ta[0][x]=13; System.out.println("ta["+y+"]["+x+"]="+ta[0][x]); } if(ta[0][x-1]==33||ta[0][x-1]==34||ta[0][x-1]==45){//hm ran=(byte)(5*Math.random()); System.out.println("ran: "+ran); if(ran==0)ta[0][x]=35; if(ran==1)ta[0][x]=44; else ta[0][x]=33; System.out.println("ta["+y+"]["+x+"]="+ta[0][x]); } if(ta[0][x-1]==31||ta[0][x-1]==51){//valley m ran=(byte)(2*Math.random()); System.out.println("ran: "+ran); if(ran==0)ta[0][x]=50; else ta[0][x]=31; System.out.println("ta["+y+"]["+x+"]="+ta[0][x]); } } }

x?

10

y?

5

ran: 4

ran: 2

ta[0][1]=51

ran: 0

ta[0][2]=50

ran: 1

ta[0][3]=30

ran: 2

ta[0][4]=51

ran: 1

ta[0][5]=31

ran: 1

ta[0][6]=31

ran: 0

ta[0][7]=50

ran: 0

ta[0][8]=30

ran: 4

ta[0][9]=30

Press any key to continue...

As you can see, there are 2 errors:

ta[0][3] should = 12

ta[0][8] should = 0