code: public function getRandomNumber ($base)
  	{	
  		$x = $this->x ();
  		$y = $this->y ();
  
  		$in = md5 ($x . $base . $y);
  
  		$chars = 5;
  		$in = substr ($in, ($x * $y) % (32 - $chars), $chars);
  		
  		return round ((base_convert ($in, 16, 10) % $base) + 1);
  	}
docs: Get a random int based on $x, $y and $base