title: How to replace the characters of a variable with some random numbers in Jmeter
body: <p>I am trying to pick up a variable from Debug Sampler and replace the characters of the variables with some Randomly generated number. I have added a BeanShell Sampler for writing the custom code. Below is the piece of code:</p>
  
  <blockquote>
  <pre><code>String myvariable = vars.get("Corr_ContextN");
  chars1 = new ArrayList();
  chars2 = new ArrayList();
  
  for(int i =0; i&lt;myvariable.length(); i++) {
  chars1.add(myvariable.charAt(i)); }
  
  String value = chars1.toString();
  
  Random randomnumber = new Random();
  for (int idx=1; idx &lt; 15; ++idx) {
  chars2.add(randomnumber.nextInt(100)); }
  
  String Newvalue1 = chars2.toString();
  vars.put("NewVariable", Newvalue1 );
  </code></pre>
  </blockquote>
  
  <p>By the above way I get a New variable in the Debug Sampler (NewVariable) with a list of random numbers. But I want to replace the existing variable "Corr_ContextN" with this NewVariable created. In other words the existing variable should be replaced by some dynamically generated number/variable.</p>
  
  <p>Please help me out. </p>