Random number

Is there a way to get a number between 0-9 random into a variable?

And if that is possible the next time the flow operates the first random number achieved will not be used the next time?

Want to use this to listen to radiostations on my Sonos, but want to listen to five different stations in a week. It would be nice if the way the radiostation are selected happens in a random way.

It is even really easy when using the normal logic
{{random(0,9)}}
This will choose a random number between 0 and 9 everytime it is being run

5 Likes

Wow, that easy? Thx, gives even more possibilities.

Hi Caseda.
I see that this is a while back, but I’m trying to make this work.
I am using Google TTS and I want to make Google give a number at random between 1 and 6 like a die.

When I try your way it results in an unspeakably high number. Any idea why this would happen?

Thanks.

This is a “bug” of float numbers in Javascript, you can “fix” this by rounding it up {{round(random(0,6))}}

Thank you. Figured it out and works great now :+1:t2:
Is it a bug? Seems the round property just removes the decimals.

No.