How to make random colors?

How to make a set of 4 random RGB colours? In freeglut or glut. Or opengl.

Generate 4 random float values in [0, 1] and pass them to glColor4f().

well it is not so straight forward.
I have 6 colors.
blue, green, yellow, light blue, white and red.
I want to create a set of 4 colors from them.

colours array[6] = {sblue, sgreen, slblue, syellow, sred, swhite}


I got this. All the members are the objects of my structure colours whose members are R, G, B.
How can I do it?

struct colours
       int red;
       int green;
       int blue;
}sblue, sgreen, slblue, syellow, sred, swhite;
int createrandomcolors()
{ = 0; = 0; = 255; = 0; = 100; = 0; 0; = 255; =255; =265; = 140; = 0; =1; = 0; = 0;; = 1; =1;
    colours array[6] = {sblue, sgreen, slblue, syellow, sred, swhite};   

So what you want to do is to pick 4 out of those colours at random? That was completely impossible to guess from your original post.

Just generate 4 random integers, to use as indices for an array of colours?

Sorry about that. I suck at making posts.
could you please tell me in detail how to do that?


Or you can use the built-in noise function in the shader language.