Random Color Strip and Sensor PIR

I am working with NeoPixel led strip and PIR sensor, I want to activate the led strip, when the PIR detects, but the problem I have is that while the PIR is detecting the led strip is always changing color for the reason that it is in random, is there any way to make that once the led strip is on, it does not change color while the PIR is activated?
Thank you!

#define PIN 6
#define NUMPIXELS 10

Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strip = Adafruit_NeoPixel(50, PIN, NEO_GRB + NEO_KHZ800);
#define DELAYVAL 50

const int sensor = 2;
int estado = LOW;
int valor = 0;

void setup() {
pinMode (sensor, INPUT);
Serial.begin (9600);
strip.begin();
randomSeed(analogRead(0));
}

void loop() {

valor = digitalRead (sensor);
int r = random(255);
int g = random(255);
int b = random(255);

if (valor == HIGH) {
for(int i=0;i<NUMPIXELS;i++){
pixels.setPixelColor(i, pixels.Color(r,g,b));
pixels.show();
delay(DELAYVAL);
}
}
else {
for(int i=0; i<NUMPIXELS; i++) {
pixels.setPixelColor(i, pixels.Color(0, 0, 0));
pixels.show();
}
}
}

Welcome to the forum

Why is it that people ignore the advice that they are directed to when they join the forum ?

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

@ykm95
Put your color choosing code inside of

condition

Hi @ykm95
welcome to the Arduino-forum.

Step back from coding.
Describe it pure functional.

There is a PIR-sensor.
Each time the PIR-sensor gets triggered
choose new colors and light up the neopixels with the chosen colors.

Keep the chosen colors. Do not RE-choose the colors all the time.

This means the starting-condition is the change from PIR-sensor LOW to PIR-Sensor HIGH
This is called state-change-detection.
Search the forum or with google for the term state-change-detection

best regards Stefan

Thank you very much for your help, I got it!