Skip to content

Instantly share code, notes, and snippets.

@moeproblems
Created January 10, 2013 02:38
Show Gist options
  • Save moeproblems/4498941 to your computer and use it in GitHub Desktop.
Save moeproblems/4498941 to your computer and use it in GitHub Desktop.
function make() {
var text = "";
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for( var i=0; i < 25; i++ )
text += possible.charAt(Math.floor(Math.random() * possible.length));
return text;
}
var arr = [];
for(var i=0; i<20000; i++) {
arr.push(make());
}
var searchFor = '123';
for(var i=0; i<arr.length; i++) {
var candid = arr[i],
index = arr[i].indexOf(searchFor);
if (index >=0 ) {
alert('found a match at index = ' + index + ', string was = ' + arr[i]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment