Oh, I see. Then maybe this can help you:
#!/usr/bin/perl use warnings; use strict; my %matrix; my @symbols = qw/A R N D C Q E G + H I L K M F P S T W + Y V/; my @table = (.9799, .0002, .0009, .0010, .0003, .0008, .0017, .0021, . +0002, .0006, .0004, .0002, .0006, .0002, .0022, .0035, .0032, .0000, +.0002, .0018, .0001, .9929, .0001, .0000, .0001, .0010, .0000, .0000, . +0010, .0003, .0001, .0019, .0004, .0001, .0004, .0006, .0001, .0008, +.0000, .0001, .0004, .0001, .9867, .0036, .0000, .0004, .0006, .0006, . +0021, .0003, .0001, .0013, .0000, .0001, .0002, .0020, .0009, .0001, +.0004, .0001, .0006, .0000, .0042, .9869, .0000, .0006, .0053, .0006, . +0004, .0001, .0000, .0003, .0000, .0000, .0001, .0005, .0003, .0000, +.0000, .0001, .0001, .0001, .0000, .0000, .9987, .0000, .0000, .0000, . +0001, .0001, .0000, .0000, .0000, .0000, .0001, .0005, .0001, .0000, +.0000, .0002, .0003, .0010, .0004, .0005, .0000, .9901, .0027, .0001, . +0024, .0001, .0003, .0006, .0004, .0000, .0006, .0002, .0002, .0000, +.0000, .0001, .0010, .0000, .0007, .0056, .0000, .0035, .9865, .0004, . +0002, .0003, .0001, .0004, .0001, .0000, .0003, .0004, .0002, .0000, +.0001, .0002, .0021, .0001, .0012, .0011, .0001, .0003, .0007, .9906, . +0001, .0000, .0001, .0002, .0001, .0001, .0003, .0021, .0003, .0000, +.0000, .0005, .0001, .0008, .0018, .0003, .0001, .0020, .0001, .0000, . +9933, .0000, .0001, .0001, .0000, .0002, .0003, .0001, .0001, .0001, +.0004, .0001, .0002, .0002, .0003, .0001, .0002, .0001, .0002, .0000, . +0000, .9915, .0009, .0002, .0012, .0007, .0000, .0001, .0007, .0000, +.0001, .0033, .0003, .0001, .0003, .0000, .0000, .0006, .0001, .0001, . +0004, .0022, .9871, .0002, .0045, .0013, .0003, .0001, .0003, .0004, +.0002, .0015, .0002, .0037, .0025, .0006, .0000, .0012, .0007, .0002, . +0002, .0004, .0001, .9858, .0020, .0000, .0003, .0008, .0011, .0000, +.0001, .0001, .0001, .0001, .0000, .0000, .0000, .0002, .0000, .0000, . +0000, .0005, .0009, .0005, .9968, .0001, .0000, .0001, .0002, .0000, +.0000, .0005, .0001, .0001, .0001, .0000, .0000, .0000, .0000, .0001, . +0002, .0008, .0006, .0000, .0004, .9944, .0000, .0000, .0001, .0003, +.0028, .0000, .0013, .0005, .0002, .0001, .0001, .0008, .0003, .0002, . +0005, .0001, .0002, .0002, .0001, .0001, .9935, .0012, .0004, .0000, +.0000, .0002, .0028, .0011, .0034, .0007, .0011, .0004, .0006, .0016, . +0002, .0002, .0001, .0007, .0004, .0003, .0017, .9800, .0038, .0005, +.0002, .0002, .0022, .0002, .0013, .0004, .0001, .0003, .0002, .0002, . +0001, .0011, .0002, .0008, .0006, .0001, .0005, .0032, .9874, .0000, +.0002, .0009, .0000, .0002, .0000, .0000, .0000, .0000, .0000, .0000, . +0000, .0000, .0000, .0000, .0000, .0001, .0000, .0001, .0000, .9995, +.0001, .0000, .0001, .0000, .0003, .0000, .0003, .0000, .0001, .0000, . +0004, .0001, .0001, .0000, .0000, .0021, .0000, .0001, .0001, .0002, +.9960, .0001, .0013, .0002, .0001, .0001, .0003, .0002, .0002, .0003, . +0003, .0057, .0011, .0001, .0017, .0001, .0003, .0002, .0010, .0000, +.0002, .9866); for my $column (@symbols) { for my $row (@symbols) { $matrix{$column}{$row} = shift @table; } } my $string; $string = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +; #$string = 'SVEQRISTDIGQAYQLQGLGSNLRSIRSKTGAGEVNYIDAAKSVNDNQLLAEIG'; print "$string\n"; print map mutate($_), split //, $string; print "\n"; sub mutate { my $char = shift; my $rand = rand; my $result = 0; while ($rand > 0 and $result <= @symbols) { $rand -= $matrix{$char}{$symbols[$result++]}; } return $symbols[$result - 1]; }
Update: bugfix.

In reply to Re^3: string mutation script behaving erraticaly by choroba
in thread string mutation script behaving erraticaly by zing

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.