@ Cmd public String chooseRandom ( final String propertyKey , final List < String > randomValues ) { Randomizable < String > choice = new RandomCollection <> ( random , randomValues ) ; String currentValue = choice . get ( ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Chosen value: " + currentValue ) ; } currentValue = resolveProperty ( currentValue ) ; config . put ( propertyKey , currentValue ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "... value for '{}' was set to {}" , propertyKey , currentValue ) ; } return currentValue ; }
Randomly selects an item from a list of Strings . List items may contain placeholder tokens . The result is stored in the configuration under the specified key and also returned by this method .