deps/v8/benchmarks/regexp.js
function computeInputVariants(str, n) {
  var variants = [ str ];
  for (var i = 1; i < n; i++) {
    var pos = Math.floor(Math.random() * str.length);
    var chr = String.fromCharCode((str.charCodeAt(pos) + Math.floor(Math.random() * 128)) % 128);
    variants[i] = str.substring(0, pos) + chr + str.substring(pos + 1, str.length);
  }
  return variants;
}
function computeInputVariants(str, n) {
  var variants = [ str ];
  for (var i = 1; i < n; i++) {
    var pos = Math.floor(Math.random() * str.length);
    var chr = String.fromCharCode((str.charCodeAt(pos) + Math.floor(Math.random() * 128)) % 128);
    variants[i] = str.substring(0, pos) + chr + str.substring(pos + 1, str.length);
  }
  return variants;
}
function computeInputVariants ( str , n ) { var variants = [ str ] ; for ( var i = 1 ; i < n ; i ++ ) { var pos = Math . floor ( Math . random ( ) * str . length ) ; var chr = String . fromCharCode ( ( str . charCodeAt ( pos ) + Math . floor ( Math . random ( ) * 128 ) ) % 128 ) ; variants [ i ] = str . substring ( 0 , pos ) + chr + str . substring ( pos + 1 , str . length ) ; } return variants ; }
Returns an array of n different variants of the input string str. The variants are computed by randomly rotating one random character.
Returns an array of n different variants of the input string str . The variants are computed by randomly rotating one random character .