how do I put in a an if or else function
"if" is just a pseudocode. Use "System Compare variable" condition. And to add "Else" step, select that condition and press X on keyboard.
when I run it like this it just displays a 1 when I click the button
Maybe the text is too small? Also, the formula should be int(random(1, variable1+1))