#include <Adafruit_NeoPixel.h>

Adafruit_NeoPixel pixels_DEL_RVB = Adafruit_NeoPixel(38, 10, NEO_GRB + NEO_KHZ800);
long math_random_int(int a,int b) {
  if (a > b) {
    // Swap a and b to ensure a is smaller.
    int c = a;
    a = b;
    b = c;
  }
  return random(a,b);
}

int mode;
int button;
int new_button;
int i;
int k;

void setup() {
  pinMode(10, OUTPUT);
  pixels_DEL_RVB.begin();
    mode = 0;
  button = 1;
  new_button = 0;

  pinMode(5, INPUT);
}

void loop() {
  pinMode(5, INPUT_PULLUP);
  new_button = digitalRead(5);
  if (button == 1 && new_button == 0) {
    mode = mode + 1;
    if (mode >= 2) {
      mode = 0;

    }

  }
  button = new_button;
  if (mode == 0) {
    for (i = 0; i <= 37; i=i+4) {
      pixels_DEL_RVB.setPixelColor(i, pixels_DEL_RVB.Color((math_random_int(1, 40) + 30),math_random_int(2, 8),0));
      pixels_DEL_RVB.show();
    }
    for (i = 1; i <= 37; i=i+4) {
      k = math_random_int(0, 2);
      pixels_DEL_RVB.setPixelColor(i, pixels_DEL_RVB.Color((math_random_int(50, 70) * k),(math_random_int(25, 40) * k),0));
      pixels_DEL_RVB.show();
    }
    for (i = 2; i <= 37; i=i+4) {
      k = math_random_int(0, 2);
      pixels_DEL_RVB.setPixelColor(i, pixels_DEL_RVB.Color((math_random_int(50, 70) * k),(math_random_int(25, 40) * k),0));
      pixels_DEL_RVB.show();
    }
    for (i = 3; i <= 37; i=i+4) {
      k = math_random_int(0, 2);
      pixels_DEL_RVB.setPixelColor(i, pixels_DEL_RVB.Color((math_random_int(50, 70) * k),(math_random_int(25, 40) * k),0));
      pixels_DEL_RVB.show();
    }
    delay(math_random_int(1, 20));

  } else {
    for (i = 0; i <= 37; i=i+4) {
      pixels_DEL_RVB.setPixelColor(i, pixels_DEL_RVB.Color(0,math_random_int(2, 8),(math_random_int(1, 40) + 30)));
      pixels_DEL_RVB.show();
    }
    for (i = 1; i <= 37; i=i+4) {
      k = math_random_int(0, 2);
      pixels_DEL_RVB.setPixelColor(i, pixels_DEL_RVB.Color(0,(math_random_int(15, 30) * k),(math_random_int(20, 40) * k)));
      pixels_DEL_RVB.show();
    }
    for (i = 2; i <= 37; i=i+4) {
      k = math_random_int(0, 2);
      pixels_DEL_RVB.setPixelColor(i, pixels_DEL_RVB.Color(0,(math_random_int(20, 35) * k),(math_random_int(25, 50) * k)));
      pixels_DEL_RVB.show();
    }
    for (i = 3; i <= 37; i=i+4) {
      k = math_random_int(0, 2);
      pixels_DEL_RVB.setPixelColor(i, pixels_DEL_RVB.Color(0,(math_random_int(15, 30) * k),(math_random_int(20, 40) * k)));
      pixels_DEL_RVB.show();
    }
    delay(math_random_int(1, 20));

  }

}
