/** * Get a randomly selected mirror from our database * * @return array */ public function getRandomMirror() { $iCount = $this->db->selectOne('mirrors', 'count(id)'); if ($iCount < 0) { throw new \Exception("There are no mirrors in the database."); } $iRandom = \Sodium::randombytes_uniform($iCount); return $this->db->selectRow('mirrors', [], [], [], [], $iRandom); }