本文整理汇总了PHP中tools::generateRandomInt方法的典型用法代码示例。如果您正苦于以下问题:PHP tools::generateRandomInt方法的具体用法?PHP tools::generateRandomInt怎么用?PHP tools::generateRandomInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tools
的用法示例。
在下文中一共展示了tools::generateRandomInt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($socket, $index, $address)
{
// set private variables
$this->socket = $socket;
$this->index = $index;
$this->ip = $address['ip'];
$this->port = $address['port'];
// create challenge
$this->challenge = tools::generateRandomString(10);
// create session
$this->session = tools::generateRandomInt(5);
// send challenge to client
$response = gamespy::xor_this('\\lc\\1\\challenge\\' . $this->challenge . '\\id\\1') . '\\final\\';
tools::log('server: ' . '\\lc\\1\\challenge\\' . $this->challenge . '\\id\\1' . '\\final\\');
socket_write($this->socket, $response);
tools::log('initializing new client (' . $this->ip . ':' . $this->port . ')');
}
示例2: __construct
/**
* Constructor for gpcm class - initialize all necessary variables
* @param type $socket
* @param type $index
* @param type $address
*/
public function __construct($socket, $index, $address)
{
// set private variables
$this->socket = $socket;
$this->index = $index;
$this->ip = $address['ip'];
$this->port = $address['port'];
// create challenge
$this->challenge = tools::generateRandomString(10);
// create session
$this->session = tools::generateRandomInt(5);
// tell our client about this great class
$response = '\\lc\\1\\challenge\\' . $this->challenge . '\\id\\1\\final\\';
socket_write($this->socket, $response);
//log
tools::log('initialized class for ' . $this->ip . ':' . $this->port);
}