(08-21-2015, 02:05 PM)skunkbad Wrote: (08-21-2015, 04:38 AM)solidcodes Wrote: Okay I just modified the codes,
Code:
private function _get_unused_id()
{
// Create a random user id
//$random_unique_int = mt_rand(1200, 4294967295);
$random_unique_int = mt_rand();
// Make sure the random user_id isn't already in use
$query = $this->db->where('user_id', $random_unique_int)
->get_where(config_item('user_table'));
if ($query->num_rows() > 0) {
$query->free_result();
// If the random user_id is already in use, get a new number
return $this->_get_unused_id();
}
return $random_unique_int;
}
It works now, but I'm not sure why brian did that.
Brian??? lol
It could be that the max value available to mt_rand is 2147483647 and not 4294967295
You might try changing the number there and see if it works. I'll have to investigate, but try that and let me know.
It is, no matter if you're on a 32 or 64-bit system. But either way - there's mt_getrandmax().