when I'm trying to get a good spread of random colour the 1st approx is setcolor rand(255),rand(255),rand(255)

but i find this is less that optimal. And here's one of the reasons why.

**linear RGB spread vs 'crested' spread**human eye is more discerning of some colors that others. For me, random colours rarely give yellows. and this spectrum shows why, yellow is a small part of the spectrum, for me at least, while green blue and red are larger. I wondered if this varies from person to person. Even if it didn't - i.e. the light from the spectrum was turned into the same data by our eyes, we all have our own interpretation of that same data.

How much red needs to be added to green to make it yellow for you?

meh, I don't want to get too theoretical. I just want a practical random spread. So I made a simple crested function to replace a standard linear function, that improves the perceived colour spread for me. Anyone looked at this before? I expect some bell curve function gives the best results.

`Function colfunc:Float(x#)`

' spread over x=0 to 1, can take all positive x

' linear ( true ) colour spread

While x>1

x=x-1

Wend

If x<1.0/3.0 Then Return 0.0

x=x-1.0/3.0

If x<1.0/6.0 Then Return x*6.0

x=x-1.0/6.0

If x<1.0/3.0 Then Return 1.0

x=x-1.0/3.0

Return 1.0-x*6.0

End Function

Function colfunc2:Float(x#)

' adjusted (crested ) spread, for better perceived colour spread

While x>1

x=x-1

Wend

If x<1.0/3.0 Then Return 0.0

x=x-1.0/3.0

If x<1.0/12.0 Then Return x*9.0

x=x-1.0/12.0

If x<1.0/12.0 Then Return 0.75+x*3

x=x-1.0/12.0

If x<1.0/3.0 Then Return 1.0

x=x-1.0/3.0

If x<1.0/12.0 Then Return 1.0-x*3

x=x-1.0/12.0

Return 0.75-x*9.0

End Function

Local w:Float

While w<255.0

Local w2:Float=w/255.0

'DebugStop

Local red:Float=255.0*colfunc(w2)

Local gre:Float=255.0*colfunc((85.0+w)/255.0)

Local blu:Float=255.0*colfunc((170.0+w)/255.0)

SetColor red,gre,blu

DrawRect w,50,1,150

w=w+1

Wend

Flip

While Not MouseHit(1)

Wend