@@ -0,0 +1,2118 @@
+package kg.apc.jmeter.functions;%0A%0Aimport java.util.Collection;%0Aimport java.util.LinkedList;%0Aimport java.util.List;%0Aimport java.util.Random;%0A%0Aimport org.apache.jmeter.engine.util.CompoundVariable;%0Aimport org.apache.jmeter.functions.AbstractFunction;%0Aimport org.apache.jmeter.functions.InvalidVariableException;%0Aimport org.apache.jmeter.samplers.SampleResult;%0Aimport org.apache.jmeter.samplers.Sampler;%0Aimport org.apache.jmeter.threads.JMeterVariables;%0A%0Apublic class ChooseRandom extends AbstractFunction %7B%0A%0A    private static final List%3CString%3E desc = new LinkedList%3CString%3E();%0A    private static final String KEY = %22__chooseRandom%22;%0A    private static final Random random = new Random(System.currentTimeMillis());%0A%0A    static %7B%0A        desc.add(%22Any number of values to choose from%22);%0A        desc.add(%22Last value must be variable name where choice will be stored%22);%0A    %7D%0A    private Object%5B%5D values;%0A%0A    /**%0A     * No-arg constructor.%0A     */%0A    public ChooseRandom() %7B%0A    %7D%0A%0A    /**%0A     * %7B@inheritDoc%7D%0A     */%0A    @Override%0A    public synchronized String execute(SampleResult previousResult, Sampler currentSampler)%0A            throws InvalidVariableException %7B%0A        JMeterVariables vars = getVariables();%0A        String varName = ((CompoundVariable) values%5Bvalues.length - 1%5D).execute().trim();%0A        int index = random.nextInt(values.length - 1);%0A        String choice = ((CompoundVariable) values%5Bindex%5D).execute();%0A%0A        if (vars != null && varName != null && varName.length() %3E 0) %7B// vars will be null on TestPlan%0A            vars.put(varName, choice);%0A        %7D%0A%0A        return choice;%0A    %7D%0A%0A    /**%0A     * %7B@inheritDoc%7D%0A     */%0A    @Override%0A    public synchronized void setParameters(Collection%3CCompoundVariable%3E parameters) throws InvalidVariableException %7B%0A        checkMinParameterCount(parameters, 3);%0A        values = parameters.toArray();%0A    %7D%0A%0A    /**%0A     * %7B@inheritDoc%7D%0A     */%0A    @Override%0A    public String getReferenceKey() %7B%0A        return KEY;%0A    %7D%0A%0A    /**%0A     * %7B@inheritDoc%7D%0A     */%0A    @Override%0A    public List%3CString%3E getArgumentDesc() %7B%0A        return desc;%0A    %7D%0A%7D%0A

add random choice fn