function newsessionid() { $random = $this->random; if (!$random) { require_once "LoomRandom.php"; $random = new LoomRandom(); $this->random = $random; } $res = bin2hex($random->urandom_bytes(20)); if (strlen($res) < 40) { $res = str_repeat("0", 40 - strlen($res)) . $res; } return $res; }