Skip to content

Instantly share code, notes, and snippets.

@tomotomo
Last active January 30, 2016 04:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomotomo/f499e5e9d44a4cd13f38 to your computer and use it in GitHub Desktop.
Save tomotomo/f499e5e9d44a4cd13f38 to your computer and use it in GitHub Desktop.
Paizaの眼帯がゲットできなくてむしゃくしゃしたからテストデータ生成スクリプト作った
<?php
# 利用例
# $ php genGantaiData.php > data.txt
$n = 30;
echo $n . PHP_EOL;
$data1 = output($n);
echo $data1[0] . PHP_EOL;
echo $data1[1] . PHP_EOL;
$data2 = output($n);
echo $data2[0] . PHP_EOL;
echo $data2[1] . PHP_EOL;
function output($number) {
$out = [];
for ($i=1; $i<=$number; $i++) {
if (!rand(0, 10)) {
$out[] = $i;
}
}
if (empty($out)) {
return [1, rand(1, $number)];
}
return [count($out), implode(" ", $out)];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment