private void boundSize ( HashSetModifiableDBIDs set , int items ) { if ( set . size ( ) > items ) { DBIDs sample = DBIDUtil . randomSample ( set , items , rnd ) ; set . clear ( ) ; set . addDBIDs ( sample ) ; } }
Bound the size of a set by random sampling .