Hi,
you could use this JAVA code in a beanshell PreProcessor:
//code start
import java.util.Random;

chars = "ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz"; 
int string_length = 8; 
randomstring =""; 
    for (int i=0; i<string_length; i++) { 
        Random randomGenerator = new Random();
        int randomInt = randomGenerator.nextInt(chars.length());
        randomstring += chars.substring(randomInt,randomInt+1); 
    } 

vars.put("yourValue",randomstring);
//code end




The above code creates a random string and outputs to the variable yourValue
This can be accessed in the normal way by using:
${yourValue}


HTH
ZK

--
View this message in context: 
http://jmeter.512774.n5.nabble.com/Setting-random-string-in-a-text-field-tp5432039p5432410.html
Sent from the JMeter - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@jmeter.apache.org
For additional commands, e-mail: user-h...@jmeter.apache.org

Reply via email to