19 declare(strict_types=1);
58 public function __construct(array $user_ids,
int $num_assignments)
60 $this->user_ids = array_values($user_ids);
63 $num_assignments = min($num_assignments, count($user_ids) - 1);
66 $num_assignments = max($num_assignments, 0);
85 while (count($user_ids) > 0) {
86 $next = rand(0, count($user_ids) - 1);
87 $order[] = $user_ids[$next];
88 unset($user_ids[$next]);
89 $user_ids = array_values($user_ids);
107 $key = array_search($user_id, $this->user_order);
108 if ($key ===
false) {
112 $peer_key = ($key + $j) % (count($this->user_order));
113 $peers[] = $this->user_order[$peer_key];
randomUserOrder(array $user_ids)
Random user order.
__construct(array $user_ids, int $num_assignments)
ExcPeerReviewDistribution constructor.
getPeersOfRater(int $user_id)
Get peers of rater.
Calculates peer review distribution (rater to peer assignments)