@Override
	public long random()
	{
		final int roomCount=roomCount();
		if(roomCount<=0) return -1;
		final int which=CMLib.dice().roll(1,roomCount,-1);
		long count=0;
		for(int i=0;i<xs.length;i++)
		{
			if((xs[i]&NEXT_FLAG)>0)
				count=count+1+(xs[i+1]-(xs[i]&NEXT_BITS));
			else
				count++;
			if(which<count)
			{
				if((xs[i]&NEXT_FLAG)>0)
					return (xs[i+1]-(count-which))+1;
				return xs[i]&NEXT_BITS;
			}
		}
		for(int i=0;i<ys.length;i++)
		{
			if((ys[i]&NEXT_FLAGL)>0)
				count=count+1+(int)(ys[i+1]-(ys[i]&NEXT_BITSL));
			else
				count++;
			if(which<count)
			{
				if((ys[i]&NEXT_FLAGL)>0)
					return (ys[i+1]-(count-which))+1;
				return ys[i]&NEXT_BITSL;
			}
		}
		Log.errOut("CMINTS","Unable to select a random room int. Picked "+which+"/"+roomCount);
		return -1;
	}