コード例 #1
0
/**
 * Init function of API.
 */
function init()
{
    if ($paramArr = getParam()) {
        $repeat = $paramArr[0];
        for ($i = 1; $i < 101; $i++) {
            $halfNum = $i / 100;
            for ($j = 4; $j < 29; $j++) {
                $ogListArr = getRandOgList(1, 29, $j, $repeat);
                $total = 0;
                foreach ($ogListArr as $ogList) {
                    $statics = execute($ogList, $halfNum);
                    $total += $statics['count'];
                }
                $avgNumber = $total / $repeat;
                echo $avgNumber;
                if ($j < 28) {
                    echo ',';
                }
            }
            echo '<br>';
        }
    } else {
        printParamErr();
    }
}
コード例 #2
0
/**
 * Init function of API.
 */
function init()
{
    if ($paramArr = getParam()) {
        $repeat = $paramArr[2];
        for ($i = 4; $i < 30; $i++) {
            $ogListArr = getRandOgList(1, 29, $i, $repeat);
            $total1 = 0;
            $total2 = 0;
            foreach ($ogListArr as $ogList) {
                echo json_encode($ogList);
                echo '<br>';
                $statics = execute($ogList, $paramArr[0], $paramArr[1]);
                $total1 += $statics[0]['count'];
                $total2 += $statics[1]['count'];
            }
            $avg1 = $total1 / $repeat;
            $avg2 = $total2 / $repeat;
            echo '1/2 --- ' . (string) $avg1 . '<br>';
            echo '1   --- ' . (string) $avg2 . '<br>';
            echo '<br>';
        }
    } else {
        printParamErr();
    }
}