Random number - range from varA to varB

Hello,
can someone help me with the javascript? I need a piece of script that can choose a random number from a range, but I want to input a range from variables, so for example, varA is 1, barB is 7, then it can randomize a number from 1 to 7.
I'm not sure where you want to use it, but the last line in the below code will be a random number between varA and varB.

JavaScript:
var a = $gameVariables.value(idA); //replace idA with ID of varA
var b = $gameVariables.value(idB); //replace idB with ID of varB
a + Math.randomInt(b-a);

Hopefully you can shimmy it around to suit your needs if necessary. 🙂
Or this:
Code:
GenerateRandomNumber = function(min, max){
    min = Math.ceil(min);
    max = Math.floor(max);
    return Math.floor(Math.random() * (max - min + 1)) + min;
}
@Silva, it works like a charm! Thank you so much.

Original thread: https://forums.rpgmakerweb.com/threads/random-number-range-from-vara-to-varb.119487/