1
0
This commit is contained in:
2022-09-21 14:01:45 +02:00
parent 0a30f39eb4
commit cfee4d93d0
349 changed files with 4 additions and 4 deletions

View File

@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
require_once __DIR__.'/../__CondorcetAutoload.php';
///
$number_of_votes = 100_000_000;
$number_of_candidates = 8;
///
$candidateName = 'A';
$candidates = [];
for ($i=0; $i < $number_of_candidates; $i++) {
$candidates[] = $candidateName++;
}
$file = new \SplFileObject(__DIR__.'/large.votes', 'w+');
$cache = '';
for ($i=0; $i < $number_of_votes; $i++) {
shuffle($candidates);
$cache .= implode('>', $candidates)."\n";
if (mb_strlen($cache) > 5_000_000) {
$file->fwrite($cache);
$cache = '';
}
}
$file->fwrite($cache);