Generating Random Numbers

Hi,

I want to generate 10 random numbers out of 20 without repeating any of
these numbers. ie. I have numbers 1 to 20 and I want to 10 numbers randomly
from this list.
I have tried using
once(int(1.0 + 20*random()))
with 10 different calculation fields but every so often the numbers overlap.
Any pointers on how I can achieve this?

Kind regards,

Sam

Hi Sam,

Martijn (of enketo.org fame) has a good thread on random number
generation at https://groups.google.com/d/msg/formhub-users/ndcyBG3I-og/2IiO0DlDYaEJ.
Try some of the ideas outlined there.

Yaw

ยทยทยท -- Need ODK services? http://nafundi.com provides form design, server setup, professional support, and software development for ODK.

On Sat, Aug 23, 2014 at 4:54 AM, Ruralnet Kalundu ruralnetkalundu@gmail.com wrote:

Hi,

I want to generate 10 random numbers out of 20 without repeating any of
these numbers. ie. I have numbers 1 to 20 and I want to 10 numbers randomly
from this list.
I have tried using
once(int(1.0 + 20*random()))
with 10 different calculation fields but every so often the numbers overlap.
Any pointers on how I can achieve this?

Kind regards,

Sam

--

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.