Having trouble assigning colour to my neopixels
You already are choosing a random LED. Now you only need to define and use the colors, that you need. Define an array with the colors:

#define COLOR_N 4
uint32_t colors[COLOR_N] = {0x00FF0000, 0x000000FF, 0x0000FF00, 0x00FFFF00};


Also define a static or global variable to hold the current color:

uint8_t current_color = 0;


Then use this array in strip.setPixelColor() with the current_color variable as index:

strip.setPixelColor(i, colors[current_color]);


Now increment current_color for the next color. To go from yellow to red again, you can use the modulo operator %:

current_color = (current_color + 1) % COLOR_N;


You can easily extend to more colors, by writing the new colors into the colors array and setting COLOR_N to the corresponding value.



About the color values: The neopixels use an RGB color model with 8 bit depth. That means, that each component (red, green and blue) occupies exactly 1 byte. Thus there are 256 steps for each component. To describe a full color, you need all three components, thus 3 bytes or 24 bits. The data type, that fits this uint32_t (unsigned integer with 32 bit), though the most significant byte is unused here (if you use an RGBW strip, this byte is the component for the white LEDs).

We can write the number, that is representing a full color, as a hexadecimal value. Each component occupies 2 hexadecimal digits:

0x00RRGGBB


where 0x is the prefix, which marks a hexadecimal number, and RR, GG and BB are the components red, green and blue of the color. So a full red is 0x00FF0000, a full blue is 0x000000FF (the leading zeros are not mandatory, but I think they help readability and comparability).

The color mixing works additive here, just like light does. All components mixed together at the same ratio gives you white, all components to zero means black. Thus you get yellow from mixing red and green the same ratio. So a full yellow is 0x00FFFF00.