private boolean nextPerm(int[] inPerm){
		// returns true if this was successful in finding the next permutation
		
		int[] outPerm = new int[inPerm.length];
		for(int i = 0; i < outPerm.length; i++){
			outPerm[i] = inPerm[i];
		}
		
		// have function (incrementWolf) which returns the next wolf ID, or zero if none
		// run increment wolf on last wolf
		// if zero, run on previous until not zero.
		// then run on wolves skipped over to end.
		int p = 0;
		int i = inPerm.length;
		do {
			i--;
			p = incrementID(i, inPerm);
			if(p == -1) break;
			outPerm[i] = p;
		} while((p == 0) && (i != -1));
		if(i == -1) return false; // This was the final permutation, inPerm remains unchanged.
		for(i = 0; i < inPerm.length; i++){
			if(outPerm[i] == 0){
				outPerm[i] = incrementID(i, outPerm);
			}
		} // outPerm now contains the next permutation
		
		for(int n = 0; n < inPerm.length; n++){
			inPerm[n] = outPerm[n];
		} // inPerm is updated to next permutation 
		
		return true;		
	}