# Normal distribution with rand(1,11)

3 Jahre 1 Monat her #109527 von tischer_s
tischer_s erstellte das Thema Normal distribution with rand(1,11)
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

Bitte Anmelden um der Konversation beizutretten.

3 Jahre 1 Monat her #109528 von holch
holch antwortete auf das Thema: Normal distribution with rand(1,11)
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.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.

Bitte Anmelden um der Konversation beizutretten.

3 Jahre 1 Monat her #109530 von tischer_s
tischer_s antwortete auf das Thema: Normal distribution with rand(1,11)
Hi holch,

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

Bitte Anmelden um der Konversation beizutretten.

3 Jahre 1 Monat her #109551 von DenisChenu
DenisChenu antwortete auf das Thema: Normal distribution with rand(1,11)
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 development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Bitte Anmelden um der Konversation beizutretten.

3 Jahre 1 Monat her #109593 von tischer_s
tischer_s antwortete auf das Thema: Normal distribution with rand(1,11)
Hi DenisChenu,

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.

Bitte Anmelden um der Konversation beizutretten.

### Haben Sie schon bei unserer Kundenumfrage mitgemacht?

Verpassen Sie nicht Ihre Chance auf tolle Preise.

Klicken sie hier um teilzunehmen: