protected static final float [ ] getSpreadInRange ( float member , int count , int max , int offset ) { // to find the spread, we first find the min that is a // multiple of max/count away from the member int interval = max / count ; float min = ( member + offset ) % interval ; if ( min == 0 && member == max ) { min += interval ; } float [ ] range = new float [ count ] ; for ( int i = 0 ; i < count ; i ++ ) { range [ i ] = min + interval * i + offset ; } return range ; }
Returns a spread of integers in a range [ 0 max ) that includes count . The spread is sorted from largest to smallest .