random($step); for ($i = 1; $i <= $step; $i++) { $byte = $bytes[$i] & $mask; if (isset($alphabet[$byte])) { $id .= $alphabet[$byte]; if (strlen($id) === $size) { return $id; } } } } } }