[ODK Community] Random number generation, each number for fixed number number of time

Yes. But there is no mechanism to make the random numbers follow a specific
distribution across all devices. We rely on each device picking good random
numbers so that the overall set of devices comprises the specific
distribution you want to achieve. The only random distribution we provide
is a uniform distribution through the random() function (generating numbers
in the range from 0.0 up to but not including 1.0).

Whenever you use the random() function within ODK Collect forms, you must
wrap it with the once() function, so that the random value is generated
exactly once and is otherwise immutable. Otherwise, each time you edit a
form, a new random number would be generated.

The general approach would be to have a calculated field such as:

once(int(100*random())+1)

This would generate a random number between 1 and 100, inclusive.

For your survey, you need to determine whether you want to ask each
respondent a fixed number of sections (e.g., 2 of 10) or if you want each
section to be independently-likely to be asked (which could lead to some
respondents having to answer all 10 sections, and some not answering any).

If you want to ask a fixed number of sections, you would want to (e.g., for
2 of 10):

(1) calculate a random number between 1 and 10
(2) calculate a random number between 1 and 9
(3) adjust the 2nd number so that if it is less than the first, it is
unchanged, but if it is equal to or greater than the first, you add 1 to it.

Then use the first number and the adjusted number to select which of your
10 sections are relevant.

ยทยทยท On Sun, Nov 13, 2016 at 4:24 AM, Shahadat Hossain wrote:

Hi,

In my survey, I have 10 sections in the questionnaire and each of the
section will arise randomly for different respondents.
But I expect, in total sample size, each of the section will be responded
for fixed number of times.

For example, for 100 sample size, I expect each section will be
responded 10 times, but which subsection will arise to respondent will be
determined randomly.

Now, is there any option to control random number generation for certain
time using ODK tool in Excel (xlsx to xml) (sequence of appearing does not
matter) ?

Thanks in advance

--
--
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