For some reason I never was that excited about trying to accomplish these sorts of things in Perl:
1..rand(256)).inject("") {|string,n| string + ('a'..'z').to_a[rand(25)] }
This generates a string from 1 to 256 characters long, containing random letters from 'a' to 'z'.
Normally, I wouldn't use something that's quite so unreadable, but I'm starting to like Ruby's way of taking what should be a very simple operation that I might have done in 3-5 lines in Perl and boiling it down to a single line.
I'd love to see if anyone can make this more succinct (but one line is still a requirement!)
Here's the code in it's context. It's just a test script writing into my partition table every minute so I can verify my Events from previous posts are working correctly.
Recent comments
2 weeks 2 days ago
7 weeks 6 days ago
8 weeks 1 hour ago
8 weeks 1 hour ago
8 weeks 15 hours ago
8 weeks 18 hours ago
8 weeks 18 hours ago
15 weeks 6 days ago
16 weeks 6 days ago
16 weeks 6 days ago