Here's the function you want:

void MakeColor(const CExtendedLap* pLap, float* pR, float* pG, float*pB)
{
  srand((int)pLap);
  do
  {
    *pR = RandDouble();
    *pG = RandDouble();
    *pB = RandDouble();
  } while(*pR + *pG + *pB < 1.5);
}

1) You can't have srand inside the loop.  What srand does is make it so
that the next random number sequence will always be the same, for the same
input of srand.  So by doing srand(pLap), it makes it so that a given lap
will always have the same colours generated.
2) Look up the concept of scoping in C++, that's why your variables aren't
not being found.  Variables are only available within the curly brackets
that they're declared within.
3) A const variable cannot be modified after it is declared.  They're
useful as a defensive programming practice, to make sure that you don't do
something dumb and overwrite something later.  In the case of these
colours, it may be necessary to make them non-const.

On Wed, Dec 19, 2012 at 1:56 PM, KDJones2 <notifications@github.com> wrote:

> In PitsideConsole/PitsideConsole/LapPainter.cpp:
>
> > @@ -297,10 +297,16 @@ void CLapPainter::DrawGeneralGraph(const LAPSUPPLIEROPTIONS& sfLapOpts, bool fHi
> >
> >
> >          srand((int)pLap);
> > -        const float r = RandDouble()*0.55 + 0.45;
> > -        const float g = RandDouble()*0.55 + 0.45;
> > -        const float b = RandDouble()*0.55 + 0.45;
> > -        glColor3d( r, g, b );
> > +		const float r = RandDouble();
> > +		const float g = RandDouble();
> > +		const float b = RandDouble();
> > +		if ((r + g + b) < 1.5) // Keep searching for a color that will provide enough contrast for a black background
> > +		{
> > +			const float r = RandDouble() + 0.33;	// <-- randomizes colours. We need to limit this so that we have good contrast.
> > +			const float g = RandDouble() + 0.33;	// <-- randomizes colours. We need to limit this so that we have good contrast.
> > +			const float b = RandDouble() + 0.33;	// <-- randomizes colours. We need to limit this so that we have good contrast.
> > +   		}
>
> I understand this, and realized that this might happen in certain
> situations. Only in the case of a 1.0 / 0.25 / 0.25 RGB or less would this
> happen, but I am pretty certain you understand this as well. I used this
> for the current version, and am continuing to improve the logic to remove
> these boundary cases.
>
> I am still running into a problem however with the CONST FLOAT, as this
> CONST treatment I don't yet fully understand what can and cannot be done
> with it. My current code to fix things gives me a "variable undefined'
> execution error when I try:
>
> // Code changed to improve the contrast of the map.
> float rf = RandDouble();
> float gf = RandDouble();
> float bf = RandDouble();
> if ((rf + gf + bf) < 1.5) // Color is too dark. Adjust to a color that
> will provide enough contrast for a black background
> {
> if (rf < 0.66) {
> const float r = rf + 0.33; // <-- Increase the amount of Red
> }
> if (gf < 0.66) {
> const float g = gf + 0.33; // <-- Increase the amount of Green
> }
> if (bf < 0.66) {
> const float b = bf + 0.33; // <-- Increase the amount of Blue
> }
> }
> else { // Color is OK. Just load values into RGB constants.
> const float r = rf;
> const float g = gf;
> const float b = bf;
> }
>
> Apparently CONST FLOAT cannot be in a statement where variables are being
> used (?)
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/arthare/wifilapper/pull/9/files#r2467934>.
>
>