Brownian noise generation in Audacity

Dear programmers,

I’m in search of a few minutes stretch of Brownian noise, which needs to be quite controlled.
For that purpose, I would like to ask how is the Brownian noise created in Audacity.
I’m not a programmer, but being a physicist I can read Matlab (though perhaps not Nyquist) code, and will be extremely grateful for a detailed explanation.

Many thanks in advance,
Moran

The Noise Generator is written in C++. Here’s the code for all 3 noise types:

bool EffectNoise::MakeNoise(float *buffer, sampleCount len, float fs, float amplitude)
{
   float white;
   sampleCount i;
   float div = ((float)RAND_MAX) / 2.0f;

   switch (noiseType) {
   default:
   case 0: // white
       for(i=0; i<len; i++)
          buffer[i] = amplitude * ((rand() / div) - 1.0f);
       break;

   case 1: // pink
      // based on Paul Kellet's "instrumentation grade" algorithm.
      white=0;

      // 0.129f is an experimental normalization factor.
      amplitude *= 0.129f;
      for(i=0; i<len; i++) {
      white=(rand() / div) - 1.0f;
      buf0=0.99886f * buf0 + 0.0555179f * white;
      buf1=0.99332f * buf1 + 0.0750759f * white;
      buf2=0.96900f * buf2 + 0.1538520f * white;
      buf3=0.86650f * buf3 + 0.3104856f * white;
      buf4=0.55000f * buf4 + 0.5329522f * white;
      buf5=-0.7616f * buf5 - 0.0168980f * white;
      buffer[i] = amplitude * 
         (buf0 + buf1 + buf2 + buf3 + buf4 + buf5 + buf6 + white * 0.5362);
      buf6 = white * 0.115926; 
      }
      break;

   case 2: // Brownian
       white=0;
       //float leakage=0.997; // experimental value at 44.1kHz
       //double scaling = 0.05; // experimental value at 44.1kHz
       // min and max protect against instability at extreme sample rates.
       float leakage = ((fs-144.0)/fs < 0.9999)? (fs-144.0)/fs : 0.9999;
       float scaling = (9.0/sqrt(fs) > 0.01)? 9.0/sqrt(fs) : 0.01;

       for(i=0; i<len; i++){
         white=(rand() / div) - 1.0f;
         z = leakage * y + white * scaling;
         y = (fabs(z) > 1.0) ? (leakage * y - white * scaling) : z;
         buffer[i] = amplitude * y;
       }
       break;
   }
   return true;
}

As you can see, there are some “experimental” parameters. I guess that is not exactly what you would understand as “controlled”.
For a Nyquist discussion, see A Study in Pink

Thanks!

So if I understand correctly, the different noises are created by filtering white noise?