I found another question about this and followed the instructions:
create a question of type "equation" (question code? let's say "randomnumber")
question text: {if(!is_empty(randomnumber),rand(1,2,3,4),randomnumber)}
Question 1, relevance equation: "randomnumber==1"
Question 2, relevance equation: "randomnumber==2"
Question 3, relevance equation: "randomnumber=

"
Question 4, relevance equation: "randomnumber==4"
However the randomized question doesn't show up when I preview the survey. Does anyone have any idea of what I'm doing wrong?