public void set(int symbol, int freq) {
		if (symbol < 0 || symbol >= frequencies.length)
			throw new IllegalArgumentException("Symbol out of range");
		if (freq < 0)
			throw new IllegalArgumentException("Negative frequency");
		
		total = checkedAdd(total - frequencies[symbol], freq);
		frequencies[symbol] = freq;
		cumulative = null;
	}