Random Variable

I have a var called “ans” and at the moment it has the value of 5, i want it to have a random value between 1-100, and i want it to keep the samwe value untill b.text == ans