K
Kevin
[Note: parts of this message were removed to make it a legal post.]
I'm trying to generate a random set of strings to fill a database with that
match the following pattern: /^([A-Z]|[a-z]|-)+$/
The array I'm trying to create must contain strings that look like
"A12-34-4567" and be exactly ten characters long I have seen code on the
internet for generating random strings but I don't have internet at home at
the moment to really study examples like the one here:
http://coderrr.wordpress.com/2008/10/28/ruby-golf-generating-random-strings
I'm guessing that something like map { if /^([A-Z]|[a-z]|-)+$/ &
char.len==10
strings<< current_matching_value
}
would achieve the right solution. Any pointers would be greatly
appreciated.
I'm trying to generate a random set of strings to fill a database with that
match the following pattern: /^([A-Z]|[a-z]|-)+$/
The array I'm trying to create must contain strings that look like
"A12-34-4567" and be exactly ten characters long I have seen code on the
internet for generating random strings but I don't have internet at home at
the moment to really study examples like the one here:
http://coderrr.wordpress.com/2008/10/28/ruby-golf-generating-random-strings
I'm guessing that something like map { if /^([A-Z]|[a-z]|-)+$/ &
char.len==10
strings<< current_matching_value
}
would achieve the right solution. Any pointers would be greatly
appreciated.