'random' Not declared in this scope in a function?

Hi All
I’m working, for the 1st time, with functions I’ve written and stored in the library as .h files.
The function is very simple, it just assigns a random number to a variable, or should, but I get the error “‘random’ was not declared in this scope” in ‘void tlc_RandomDim()’. It works if I assign the random to the variable in the main loop and declare the variable without random in the function, but I can’t tell if it’s giving me a random number or not.
I’ve pasted the code below, thanks for any help you may be able to provide.
The Function

// Function to randomly dim 1 LED from each Column

#ifndef TLC_RANDOMDIM_FUNCTION_H
#define TLC_RANDOMDIM_FUNCTION_H

#include "tlc_config.h"
#include "Tlc5940.h"

void tlc_RandomDim(void);

void tlc_RandomDim(void)
{
    int i;
  long randled1 = random(1, 8);
  long randled2 = random(9, 16);
  long randled3 = random(17, 24);
  long randled4 = random(25, 32);
    
    Tlc.init(4095);
            
    for (i=4095; i > 0; i = i - 1){
      Tlc.set(randled1, i);
      Tlc.set(randled2, i);
      Tlc.set(randled3, i);
      Tlc.set(randled4, i);
      Tlc.update();
    }
    for (i=0; i < 4095; i = i + 1){
      Tlc.set(randled1, i);
      Tlc.set(randled2, i);
      Tlc.set(randled3, i);
      Tlc.set(randled4, i);
      Tlc.update();
    }
}

#endif

The main code:

#include "Tlc5940.h"
#include "Tlc_Randomdim_function.h"

void setup()
{
  /* Call Tlc.init() to setup the tlc.
     You can optionally pass an initial PWM value (0 - 4095) for all channels.*/
  Tlc.init(4095);
}

void loop()
{
  tlc_RandomDim();
}

The error message is telling you exactly what the problem is. You are trying to call a function that is not defined in your library. The library, when it is compiled, has no idea where the random() function is, because you haven't told it.

You haven't, explicitly, in the sketch, either, but the IDE modifies your sketch before compiling, adding #include Arduino.h or #include WProgram.h to the sketch (among other things), depending on which version of the IDE you are using.

If you add the same include file to your sketch, the random() function WILL be defined.

Now I see, you rock Paul! just added #include "Adrduino.h" to the function and it's all good.

Thanks for the speedy help, I'm sure the baby will appreciate it if I get this light working before he's born :D