You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Overview

You can generate either a random decimal number (ex. 8.9) or a random integer (ex. 23) using the random() function.  Set the calculate expression of your question to the following:

  1. For a random decimal: start_num + (random() * (end_num - start_num)) For example, to generate random number between 10.3 and 30.9, you can use 10.3 + (random() * (30.9 - 10.3))
  2. For a random integer: start_num + int(random() * (end_num - start_num)) For example, to generate random number between 9 and 22, you can use 9 + int(random() * (22 - 9))

You can also replace start_num and end_num with references to other questions in your form (ex. /data/my_start_range_question).  Please make sure that they are required or have value so that the calculate expression works. 

  • No labels