Arduino multi function

Hello,

I cant figure it out how to do this thing and I need forum people help.
What I want to do:

  1. Random color (Red, Green or Blue)
  2. Random led brightness (from 1 to 255)
  3. Random how many leds shine (I have 96 rgb leds)
  4. Random which leds shine (RED from 1 to 96 pin, GREEN from 97 to 192 pin, BLUE from 193 to 288 pin)
  5. Make leds fade shine all at once

This is my try without step 5, because I cant figure it out how to do it:

int diodu_skaicius;                                        //led_number
int pasirinkti_diodai[96];                                 //random_led
char *spalva[] = {"Red", "Green", "Blue"};                 //color
long RGB;                                                  
int new_red, new_green, new_blue;                         
boolean pabaiga;                                           //end
int led_new_red[96], led_new_green[96], led_new_blue[96];  
int led_old_red[96], led_old_green[96], led_old_blue[96];  
int i, r, g, b;                                              //variables


void setup() {
  Serial.begin(9600);   
}

void loop() {
  
//1. Random color (Red, Green or Blue)
  RGB = random(sizeof(spalva)/sizeof(char*));
  Serial.print("Spalva: ");
  Serial.println(spalva[RGB]);
  delay(1000);
////////////////////////////


//2. Random led brightness (from 1 to 255)
  if (spalva[RGB] == "Red"){
    new_red = random(1, 256);
    Serial.print("new_red stiprumas: ");
    Serial.println(new_red);
    delay(1000);
  }
  
  if (spalva[RGB] == "Green"){
    new_green = random(1, 256);
    Serial.print("new_green stiprumas: ");
    Serial.println(new_green);
    delay(1000);
  }
  
  if (spalva[RGB] == "Blue"){
    new_blue = random(1, 256);
    Serial.print("new_blue stiprumas: ");
    Serial.println(new_blue);
    delay(1000);
  }
//////////////////////////////////////


//3. Random how many leds shine (I have 96 rgb leds)  
  diodu_skaicius = random(1, 97);
  Serial.print("Diodu skaicius = ");
  Serial.println(diodu_skaicius);
  delay(1000);
////////////////////////////


//4. Random which leds shine (RED from 1 to 96 pin, GREEN from 97 to 192 pin, BLUE from 193 to 288 pin)
  if (spalva[RGB] == "Red"){
    for (i = 1; i <= diodu_skaicius; i++ ){
    pasirinkti_diodai[i] = random(1, 97);
    led_new_red[pasirinkti_diodai[i]] = new_red;
    Serial.print("i red = ");
    Serial.print(i);
    Serial.print(" = ");
    Serial.println(pasirinkti_diodai[i]);
    Serial.print("led_new_red ");
    Serial.print(pasirinkti_diodai[i]);
    Serial.print(" = ");
    Serial.println(led_new_red[pasirinkti_diodai[i]]);
    delay(1000);
    }
  }
  
  if (spalva[RGB] == "Green"){
    for (i = 1; i <= diodu_skaicius; i++ ){
    pasirinkti_diodai[i] = random(97, 193);
    led_new_green[pasirinkti_diodai[i]] = new_green;
    Serial.print("i green = ");
    Serial.print(i);
    Serial.print(" = ");
    Serial.println(pasirinkti_diodai[i]);
    Serial.print("led_new_green ");
    Serial.print(pasirinkti_diodai[i]);
    Serial.print(" = ");
    Serial.println(led_new_green[pasirinkti_diodai[i]]);
    delay(1000);
    }
  }
  
  if (spalva[RGB] == "Blue"){
    for (i = 1; i <= diodu_skaicius; i++ ){
    pasirinkti_diodai[i] = random(193, 289);
    led_new_blue[pasirinkti_diodai[i]] = new_blue;
    Serial.print("i blue = ");
    Serial.print(i);
    Serial.print(" = ");
    Serial.println(pasirinkti_diodai[i]);
    Serial.print("led_new_blue ");
    Serial.print(pasirinkti_diodai[i]);
    Serial.print(" = ");
    Serial.println(led_new_blue[pasirinkti_diodai[i]]);
    delay(1000);
    }
  }
//////////////////////////////


//5. Make leds fade shine all at once
 
////////////////////
}

Simple answer is that you need to learn a lesson about time and the millis() function.

In my signature space (under this post) the first Nick Gammon tutorial can give you that in very clear terms with example code. That's the best I have seen on the topic so far.

Get into that and any questions you have will get answered.