private int[] randomVector(int length,int sum){
  int[] values=new int[length];
  values[0]=sum;
  for (int i=1; i < values.length; i++) {
    values[i]=Rand.randUniform(0,sum);
  }
  Arrays.sort(values);
  int low=0;
  for (int i=0; i < values.length; i++) {
    int rnd=values[i] - low;
    low=values[i];
    values[i]=rnd;
  }
  return values;
}

private int [ ] randomVector ( int length , int sum ) { int [ ] values = new int [ length ] ; values [ 0 ] = sum ; for ( int i = 1 ; i < values . length ; i ++ ) { values [ i ] = Rand . randUniform ( 0 , sum ) ; } Arrays . sort ( values ) ; int low = 0 ; for ( int i = 0 ; i < values . length ; i ++ ) { int rnd = values [ i ] - low ; low = values [ i ] ; values [ i ] = rnd ; } return values ; }
create an integer array of defined length , and random contents with a defined total sum .
