## Normal distribution with rand(1,11) 9 months 4 weeks ago #109527

 tischer_s OFFLINE Fresh Lemon Posts: 19 Karma: 0 Hi, I implemented the randomize function which creates random numbers from 1 to 11: rand(1,11) Unfortunately it seems not to follow the normal distribution. Based on 27 starts these are the outputed numbers: 1 1 1 1 2 3 4 4 4 6 6 6 7 7 7 7 7 8 8 8 8 8 9 10 10 10 11 Unfortunately the number 5 is missing at all and 11, 2, 3 and 9 are implemented quite less... Can someone tell me that the function really follows a normal distribution? Best Sebastian The administrator has disabled public write access.

## Normal distribution with rand(1,11) 9 months 4 weeks ago #109528

 holch NOW ONLINE LimeSurvey Team Posts: 3321 Thank you received: 442 Karma: 141 I assume that this is not the order they came in? And maybe there is a missconception. Rand should create random numbers, not following the normal distribution. With big numbers you should get close to a normal distribution, but there will always be deviations from the normal distribution. So for each draw the chance for a certain number to come up is 1/11. With 27 draws with 11 numbers to draw from you would expect every number 2-3 times in the sample. So this looks pretty good to me, considering that you had only 27 draws. With 1000 draws you should get much closer to the normal distribution. n=27 is for sure not a big enough number to judge upon. In my opinion this distribution is still within the normal chance. Have a look at the manual! It is a really valuable source for information. Here some helpful links: Manual (EN) | Question Types | Question Attributes | Workarounds If you found this answer helpful and it saved you some time please consider a donation to the project to keep Limesurvey going! The administrator has disabled public write access.

## Normal distribution with rand(1,11) 9 months 4 weeks ago #109530

 tischer_s OFFLINE Fresh Lemon Posts: 19 Karma: 0 Hi holch, thank you very much for your fast reply. The numbers came completely unordered I only sorted them to see where numbers are missing. My sample should be around 1000 people so if you can assure me that with growing sample the normal distribution will be reached Thank you very much for helping and making it clear Best Sebastian The administrator has disabled public write access.

## Normal distribution with rand(1,11) 9 months 3 weeks ago #109551

 DenisChenu OFFLINE Moderator Lime Posts: 6952 Thank you received: 929 Karma: 277 LimeSurvey use php rand function : php.net/manual/function.rand.php then if you fnd a bug in this function, please report it to php dev. In some condition use hacked phpjs function : phpjs.org/functions/rand/, if you find a bug in js rand : you can report to us, we look if it's updated in phpjs (but phpjs rand use Math.random()JavaScript function: if it's broken, you can report to your browser developper(for example microsoft for internet explorer)). Denis Assistance on LimeSurvey forum and LimeSurvey core developpement are on my free time (Say thanks ?). A bug not reported is a bug not corrected. | Please, read the documentation | La doc en français à besoin de vous Official LimeSurvey Partner | Web development | SkeletonQuest, RWD for LimeSurvey The administrator has disabled public write access.

## Normal distribution with rand(1,11) 9 months 3 weeks ago #109593

 tischer_s OFFLINE Fresh Lemon Posts: 19 Karma: 0 Hi DenisChenu, thank you very very much for your answer. May you please help me how I can exchange the rand php function with the phpjs version? Is this one better? Thank you very much for your help Best Sebastian P.S.: The randimizing function is very important since it randomizes my 11 treatments and only should show 1. The number of people receiving the survey is 50.000 so I need to have nearly a normal distribution. The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.106 seconds