 # Automate random numbers selection within a range

Question: automate random numbers selection within a range

If a form contains a series of 4 number-entry boxes [separated by tabs] and the user wants to always select an automated random number [between a defined user set of numbers], how could the user automate the task?

Example:
Temperature: [randomly chosen number between 65.1 to 70.8]

Number of years: [randomly chosen number between 6 to 22]

Number of practices: [randomly chosen number between 1 to 8]

Number of windows/rooms: [randomly chosen 4-33/7-88]

The random() function allows you to generate random numbers between 0 and 1. You can then do some simple math in a formula to convert that to whatever range you would like.

For example:

Temperature: {=65.1 + random() * (70.8 - 65.1); format=.1f}

@scott @cedric_debono
I am in love with the random TextBlaze feature. It makes me wonder if I can do something not previously considered: How about randomizing text options? For example:

{note} this struggling TextBlaze snippet wants to randomly trigger the output of one of three phrases

/TriggersDesiredAction

Where:
A = This is the first of three random texts
B = This represents the second of the text randomized
C = This third text phrase is the final random text representation

{=A + random() * (C - A); format=text}

The result of /TriggersDesiredAction might randomly be "This represents the second of the text randomized"{endnote}

I think I have answered my own question.... looking back at other FAQs:

{list=["This is the first of three random texts", "This represents the second of the text randomized", "This third text phrase is the final random text representation"]}

{=list[ceil(random() * count(list))]}

Nailed it! That's exactly what you want.