in reply to Re: Finding a random position within a long string (Activeperl Build 822)
in thread Finding a random position within a long string (Activeperl Build 822)

This might get a little fewer than the percentage requested because it's possible for it to pick the same position more than once. Try setting $percent = 90 for a good demonstration. I ran it ten times, and it never replaced more than 13/20 (well short of the expected 18/20).

  • Comment on Re^2: Finding a random position within a long string (Activeperl Build 822)
  • Download Code

Replies are listed 'Best First'.
Re^3: Finding a random position within a long string (Activeperl Build 822)
by FunkyMonk (Bishop) on Oct 12, 2007 at 21:42 UTC
    I took "about ~10%" to mean about 10% ;)