public static int getRandomUnsetBit (BitSet bs, int len)
	{
		if (bs.cardinality() >= len)
		{
			// failure
			return 0;
		}
		
		// try 20 times to see a random one
		for (int i = 0; i < 20; i++)
		{
			int idx = RandomGenerator.getInt(0, len);
			
			if (!bs.get(idx))
				return idx;
		}
		
		// trying randomly did not work		
		int numberOfUnsetBits = len - bs.cardinality();
		int numberOfUnsetBitToPick = RandomGenerator.getInt(0, numberOfUnsetBits);
		
		int j = numberOfUnsetBitToPick;
		for (int i = 0; i < len; i++)
		{
			if (!bs.get(i))
			{
				// unset bit
				j--;
				
				if (j <= 0)
				{
					//D.out("-- random chunk pick " + numberOfUnsetBitToPick + " -> " + i);
					return i;
				}
			}
		}
		
		
		// should not happen
		//D.out ("Picked chunk 0");
		return 0;
		
	}