Generating a Random number string for mobile no.

JMeter allows creation of custom number of specific length.

Put following code in “BeanShell PostProcessor” and use “Phone” variable in your JMeter.  This will generate a 10 digit random number.


import java.util.Random;

phone = “0123456789654397”;
int string_length1 = 10;
randomstring3 =””;
for (int i=0; i<string_length1; i++) {
Random randomGenerator = new Random();
int randomInt = randomGenerator.nextInt(phone.length());
randomstring3 += phone.substring(randomInt,randomInt+1);

vars.put(“Phone”, randomstring3);