Getting a random number between a min and a max
You can abstract the code in another function and then call it. 

If you are using OOP, then you can either pull that in (abstract) Parent class, this way it would be accessible to everyone. 

function getRandomPageNumber(){
    return getRandomIntInclusive(1, 5);
}