RandomWeighted(int[] weights) {
		random = new Random();
		totalWeight = 0;
		
		if (weights.length == 0)
			useWeighted = false;
		else {
			maxDivisor = findMaxDivisor(weights);
			
			String s = String.valueOf(maxDivisor);
			maxDivisorLength = (byte) s.length();
			
			table = new int[maxDivisorLength][];
			radixSum = new int[maxDivisorLength];
			
			int[] radix;
			int divisor = maxDivisor;
			int columnIndex;
			for (byte rowIndex = 0; rowIndex < maxDivisorLength; rowIndex++) {
				radix = new int[weights.length]; // reset the array each loop
				
				for (int i = 0; i < weights.length; i++) {
					radix[i] = (weights[i] / divisor) % BASE;
					radixSum[rowIndex] += radix[i];
				}
				
				table[rowIndex] = new int[radixSum[rowIndex]]; // contains the distribution for this radix position
				
				columnIndex = 0;
				for (int i = 0; i < weights.length; i++){
					for (int j = 0; j < radix[i]; j++) {
						table[rowIndex][columnIndex++] = i; // set distribution, labeled 0 to (weights.length - 1) 
					}
				}
				
				divisor /= BASE;
			}
			
			for (int i : weights) {
				totalWeight += i;
			}
			
			useWeighted = true;
		}
	}