Microblog: A very long article Wikipedia article on the orientation of toilet paper [Jun 7th, 22:52] [R]

Thursday, August 28th, 2008

Word Scrambler, Write-Only Version

Categories: [ IT ]

Here's a more compact, less readable version of the scramble function:

sub scramble {
  return $_[0] if $_[0] =˜ /ˆ[A-Z]/;
  my @l = split //,$_[0];
  @l[1..$#l-1] =
     sort { rand(1) < 0.5 ? -1 : 1 } @l[1..$#l-1];
  return join("", @l);
}

[ Posted on August 28th, 2008 at 00:05 | no comment | ]

Trackback Address

https://weber.fi.eu.org/blog/Informatique/word_scrambler_write-only_version.trackback

Comments

No comment

Add comments

You can use the following HTML tags: <p>, <br>, <em> <strong>, <pre>. URLs starting with http:// will automatically be turned into hyperlinks.

(optional)
(optional)


Save my Name and URL/Email for next time

3 + 3 =