How is FastLED beatsin8 updates its return value between successive calls

Hi All - I've looked through the FastLED docs, Arduino forums and also Google but I haven't found an answer to how the FastLED beatsin8 function updates it's return value between successive calls.

The below code works, but I do not see how beatsin8 returns different values between loops, when it is called with the same initial parameters. I am used to having to call a function with parameters that are updated by the sketch.

But with beatsin8 it seems that it is like a callback, where it is called/updated by the beatsin8 function itself. Otherwise, it would be returning the same brightness value each time through the loop because none of the parameters (beats, low value, high value) are changed by the sketch for the next call.

Any help is very much appreciated.

#include <FastLED.h>

#define DATA_PIN    4
#define LED_TYPE    WS2812B
#define COLOR_ORDER GRB
#define NUM_LEDS    10
#define BRIGHTNESS  96
CRGB leds[NUM_LEDS];

void setup() {
  delay(1000); // 3 second delay for recovery
  Serial.begin(115200);

  FastLED.addLeds<LED_TYPE,DATA_PIN,COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip);

  FastLED.setBrightness(BRIGHTNESS);
}

void loop() {
  // Get a value between 50 and 200 that changes over time
  uint8_t brightness = beatsin8(120, 50, 200);

  // Set the pixel's color and brightness
  leds[0] = CHSV(0, 255, brightness); // Red with the calculated brightness

  // Show the LEDs
  FastLED.show();
}

It's likely updated during the call to FastLED.show();

EDIT EDIT EDIT
The above answer is wrong. Look at the source code for beatsin8(). You see that it indirectly makes a call to another function that uses millis() so the return value is a function of time.

Thank you for the reply. I did see that earlier, but wasn't sure when it is called. It looks like it is called every N ms that is equal to the beats per minute (e.g. if beats per minute is 60, then it is updated every 1000ms). I guess it just updates whatever variable is assigned the return value without any more work on the part of the programmer other than setting up the initial call. That is what was confusing, because if that is the case, then it should be able to be setup anywhere in the sketch because it takes care of updating the assigned value all by itself. Thank you for your response!