Random functions in ODK Collect

Hi all,

I am currently working on a form that attempts to generate a pseudo-random number from a seed. The seed would be the answer to a previous question. The random() function as implemented doesn't seem to allow this type of use, and the documentation I've been able to find doesn't offer any alternatives, so any hints and tips on how to do this would be greatly appreciated.

Thank you in advance.

Best regards,
Todor Tochev
J-PAL Europe
Paris School of Economics

Generally, you would want to use random() within once() (e.g.,
once(random()) ) to ensure that the random value is computed only once and
never re-computed.

There isn't a mechanism to generate random values using a consistent seed
(for a consistently repeatable set of values).

If you need up to 3 random numbers, you can define 3 fields to hold them,
and then, if you only need 2, just use the first 2.

People who need to randomize the order of questions will often copy
sections of their survey, manually permute the order of questions within
the section, then use a random number to select which of the N sections of
permuted question is relevant (and therefore asked).

Ugly, but it works.

ยทยทยท On Tue, Feb 24, 2015 at 6:17 AM, wrote:

Hi all,

I am currently working on a form that attempts to generate a pseudo-random
number from a seed. The seed would be the answer to a previous question.
The random() function as implemented doesn't seem to allow this type of
use, and the documentation I've been able to find doesn't offer any
alternatives, so any hints and tips on how to do this would be greatly
appreciated.

Thank you in advance.

Best regards,
Todor Tochev
J-PAL Europe
Paris School of Economics

--

Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en


You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com