absolute encoder

I use arduino uno and absolute encoder 1024 divisions. I find a website where I see how to connect my encoder with arduino.
www.thaiconverter.com/article/14/%E0%B8%AD%E0%B9%88%E0%B8%B2%E0%B8%99%E0%B8%84%E0%B9%88%E0%B8%B2-absolute-encoder-%E0%B8%94%E0%B9%89%E0%B8%A7%E0%B8%A2-arduino
from this website I used sketch.

boolean pin_state[10];
byte input_pin[] = {2,3,4,5,6,7,8,9,10,11}; // Config Pins Input Here bit-1 to 10
int dec_position = 0;

boolean a = 0;
void setup() {

Serial.begin(9600);

for(byte i = 0; i <10; i = i +1 ){ // declare pin mode
  pinMode(input_pin[i], INPUT);
}

}

void loop() {
 Read_input(); // Read Encoder Signal
 delay(100);
 
}

void Read_input(){
  for(byte i = 0; i <10; i = i + 1 ){
    pin_state[i] = !digitalRead(input_pin[i]); // Bitwise for active LOW
  }
  
  // Gray Code Decoder
  dec_position = pin_state[9];
  for( int i = 8; i >= 0; i = i -1){
    dec_position = (dec_position << 1) | (pin_state[i] ^ (dec_position&0x1));
  }
  
  // Print 0-1023 position with line feed
  Serial.println(dec_position, DEC); 
}

and I use com-port and see how signals from encoder change.
but signals are random(example after 30 may be go 431 and etc).
can you help me?

The outputs are open collector. Do you have pullup resistors on the Arduino inputs? If not, you can enable the internal pulllups instead.

pinMode(input_pin[i], INPUT_PULLUP);

The internal pullups are 20K to 50K so may not be strong enough. If the internal pullups don't help, you will need external pullups of the value in the schematic from the linked site (2K2).

How fast is it turning? Doing 10 digital reads in a row will take 30 or 40us, which will limit the maximum
speed you can reliably read this way.

If you can do register-direct reads on the relevant ports you will get a snapshot of the Gray code
in a much shorter timeframe, like 1us or so.

But if the problem is at low speed I'd suspect you have signal integrity issues (lack of pull-ups,
too high valued pullups, interference, lack of ground connection, that sort of thing.)

Its possible the bits are changing as you are reading them. If the encoder is stationary does it read steady? if you move it to a new position and leave is stationary does it then read steady again? If yes, then using low level register reads or search for "fast digitalRead"