Once(round(random())) not working

I used the command once(round(random())) to generate a 0/1 for each form using ODK 1.29 or more recent. However, in the 327 forms created so far, the 0/1 draw has been far from 50:50. I did not find the number of the first form in each tablet being repeated for all forms created in that tablet as was the issue for ODK version 1.14 (check link: Random numbers are the same by device).
Please suggest what could be the reason.


What is the actual count of 0 vs. 1 that you have observed? Given the 327 instances, the expected count of each is 163.5. This is a random process, though, so it's highly unlikely you'd get exactly that split. By knowing what the actual count of each is, we can compute what the likelihood of the outcome you reached is.


Of the 327 draws, 190 (58.1%) were assigned 0, and 137 (41.9%) were assigned 1. Of course, it is unlikely to get an exact split but I was expecting the outcomes to be within a narrower bracket around 50/50.

This would be possible given equal odds of 0 and 1 but it is very unlikely. How many devices do you have? What Android versions do your devices use? Are you absolutely certain that they are all running Collect 1.29+? Is there anything interesting about your data collection process like does everyone start at exactly the same time?

I did a quick simulation of a form with this usage and am getting results consistent with the normal distribution I'd expect. Your result is way off in the tail.

1 Like

Thanks! I checked with the enumerators and they all use Android 7.0 and ODK 1.29 or more recent. They start data collection close to the same time at 9 am CAT.