Beispiel #1
0
 /**
  * Creates values that are different from expected, replacing chars with invalid ones using some
  * heuristics and random probability. Relates to generated charactgers, length is controlled with
  * the "invalid" variable.
  *
  * @return the next generated value.
  */
 public String randomInvalid() {
   if (rand == null)
     throw new IllegalStateException("You need to set seed before using data objects");
   int length = length();
   char[] c = new char[length];
   for (int i = 0; i < length; i++) {
     float f = rand.nextFloat(0, 1);
     if (f > invalidProbability) {
       c[i] = chars.random();
     } else {
       c[i] = chars.invalidRandom();
     }
   }
   String next = new String(c);
   history.add(next);
   record(next);
   return next;
 }