View Single Post
Old 07-26-2017, 02:23 PM   #7
SKG_Scintill
Spun a twirly fruitcake,
FFR Simfile AuthorFFR Veteran
 
SKG_Scintill's Avatar
 
Join Date: Feb 2009
Age: 33
Posts: 3,876
Default Re: Math Question - Probability

just tried it empirically with some quick code

Code:
$array = array();
for ($i = 0; $i < 1000; $i++) {
	$highest = 0;
	for ($j = 0; $j < 100; $j++) {
		$rand = mt_rand(1,5);
		if ($rand > $highest) {
			$highest = $rand;
		}
	}
	array_push($array, $highest);
}
$sum = 0;
foreach ($array as $num) {
	$sum += $num;
}
echo $sum / sizeof($array);

the $j < [num] is the amount of numbers I take before I take the best result
here's the result for different amounts
1: 3.089
2: 3.811
3: 4.162
4: 4.436
5: 4.577
10: 4.892
100: 5

so yes, it goes to 5

doesn't give a mathematical relationship but whatever I was bored
__________________





Quote:
Originally Posted by bluguerilla
So Sexy Robotnik (SKG_Scintill) {.0001/10} [--]
___
. RHYTHMS PR LAYERING
. ZOMG I HAD TO QUIT OUT TERRIBLE
.

Last edited by SKG_Scintill; 07-26-2017 at 02:25 PM..
SKG_Scintill is offline   Reply With Quote