Files
Mranalysis/createteTestRun.php
2013-10-16 23:29:49 +02:00

31 lines
573 B
PHP
Executable File

<?php
$joins = $_GET["joins"];
$joinRate = $_GET["joinrate"];
$commands = array();
$nextLeaveNumber = 2;
$joinCount = 0;
while($joinCount < $joins) {
if (rand(0, 100) < $joinRate * 100) {
array_push($commands, "J");
$joinCount++;
} else if ($nextLeaveNumber < $joinCount){
array_push($commands, "L".$nextLeaveNumber++);
}
}
echo "commands.txt\n";
foreach ($commands as $value) {
echo $value."\n";
}
echo "commands.js\n{";
foreach ($commands as $value) {
echo "\"".$value."\",";
}
echo "}\n";
print_r($commands);
?>