It changes the HP every time I roll the mouse over the token
Yeah, that sounds wrong. Rolling the mouse over a token causes the statblock popup to be displayed. If the variables in the statblock require macros to run, then they do. But the macro for HP should overwrite
the HP value with its result! So the variable contains a macro which produces a random number and overwrites the variable... The next time you roll the mouse over the token there is no macro to execute.
Have you customized any of the settings such that different variables are being displayed in the statblock? That could be one source of the problem.