def random_text( length )
output = ""
length.times do
output << ('A'..'Z').to_a[ rand(26) ]
end
output
end
then, where ever you need it : just call it
random_text( 42 ) # for 42 chars of random text ...
j.
On 10/3/05, Chris McMahon <[EMAIL PROTECTED]> wrote:
Hi...
I want to generate some random text for test purposes. "rand" doesn't
seem to DWIM. Say, to pick an arbitrary letter from the uppercase
range A to Z.
[A-Z].rand
[A..Z].rand
seems right, but isn't.
-Chris
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
--
"http://ruby-lang.org -- do you ruby?"
Jeff Wood
_______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
