Hi,
I am confused and am hoping that someone can clarify the following situation: Let say I have a dice that has 800 sides. Let say I am throwing this dice 50 times. How many different outcomes am i to expect ( outcome : the side that has its face down -> not sure if 800 side dice has a face up). Since each outcome has the same chance to appear then i would expect 50 different sides to appear once when dice is thrown 50 times. I am probably wrong here because when i do the simulation
Code:
use strict;
my %dice_outcome;
my %dice_outcome_freq;
for (1..500000){
my %shash;
for (my $i = 0; $i<50;$i++){
$shash{int(rand(800)+1)}++;
}
my $types_cnt = keys %shash;;
my $freq_cnt = 0;
foreach my $key (keys %shash){
$freq_cnt += $shash{$key};
}
$dice_outcome_freq{$freq_cnt/$types_cnt}++;
$dice_outcome{$types_cnt}++;
}
foreach my $key( sort{$a<=>$b}keys %dice_outcome){
print "$key\t$dice_outcome{$key}\t".($dice_outcome{$key}/50000)."\n";
}
print "\n\n";
foreach my $key( sort{$a<=>$b}keys %dice_outcome_freq){
print "$key\t$dice_outcome_freq{$key}\t".($dice_outcome_freq{$key}/50000)."\n";
}
Result:
Distribution of different outcomes:
40 1 2e-05
41 3 6e-05
42 18 0.00036
43 184 0.00368
44 1178 0.02356
45 5715 0.1143
46 22052 0.44104
47 64227 1.28454
48 131513 2.63026
49 170835 3.4167
50 104274 2.08548
Distribution of frequencies of diffrent outcomes:
1 104274 2.08548
1.02040816326531 170835 3.4167
1.04166666666667 131513 2.63026
1.06382978723404 64227 1.28454
1.08695652173913 22052 0.44104
1.11111111111111 5715 0.1143
1.13636363636364 1178 0.02356
1.16279069767442 184 0.00368
1.19047619047619 18 0.00036
1.21951219512195 3 6e-05
1.25 1 2e-05
i do not get this uniform distribution. Is this because the central limit theorem. and how would i calculate the average number of outcomes without the simulation having only the input values:
Number of possible outcomes: 800
Number of throws: 50
----------------------------------------------------
What is the average number of different outcomes?
What is the average frequency of the average number of different outcomes?
Thank you.