private long [ ] randomSubspace ( final int alldim , final int mindim , final int maxdim , final Random rand ) { long [ ] dimset = BitsUtil . zero ( alldim ) ; // Fill with all dimensions int [ ] dims = new int [ alldim ] ; for ( int d = 0 ; d < alldim ; d ++ ) { dims [ d ] = d ; } // Target dimensionality: int subdim = mindim + rand . nextInt ( maxdim - mindim ) ; // Shrink the subspace to the destination size for ( int d = 0 ; d < alldim - subdim ; d ++ ) { int s = rand . nextInt ( alldim - d ) ; BitsUtil . setI ( dimset , dims [ s ] ) ; dims [ s ] = dims [ alldim - d - 1 ] ; } return dimset ; }
Choose a random subspace .