How do I set a random value to a variable?

Hello,

I’m looking for a way to set a random value between 1 and 2 to a variable.
I tried this:

<Set random>rand(1, 2)</Set>

<If check="{Get random}" is value=1>
  YES
<Else if check="{Get random}" is value=2 />
  NO
</If>

But it doesn’t work :frowning:
Can someone help me, please?

Thanks,
Best regards

Hi Florian! I had to dig into our source code to figure this one out! This should do the trick:

<Math>rand_int(1, 2)</Math>

Thanks for this question, I actually learnt a bit about what our Math tag is capable of. It’s not well documented yet, but here’s the documentation that is available: Math | Tangible Loops & Logic