public int partition(T[] data, int length, int start, int end) {
		// TODO Auto-generated method stub
		if(data == null || length <=0 || start < 0 || end >= length){
			throw new IndexOutOfBoundsException("argument error!");
		}
		Random r = new Random();
		//nextInt(0,n+1) create an int in [0, n+1) == [0, n];
		int index = r.nextInt(end-start+1)+start;
		swap(data , index , end);
		
		int small = start;
		for(int i = start ; i <= end ; i++){
			if(data[i].compareTo(data[end]) < 0){
				if( small != i){
					swap(data, small , i);
				}
				small++;
			}
		}
		swap(data , small , end);		
		return small;
	}