in reply to Re: Function over all letters in a string
in thread Function over all letters in a string
On that note one could also{ my $r = substr rand, 2; sub crand() { length $r or ($r = rand) =~ tr/0-9//cd; chop $r; } } s[(.)]{$1 x (1+crand/3)}ge;
and even move the division up into crand although that's not a generic "cached rand" anymore.# ... length $r or ($r = rand) =~ tr/3-9//cd; # ... s[(.)]{$1 x crand/3}ge;
Makeshifts last the longest.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Function over all letters in a string
by Abigail-II (Bishop) on Dec 01, 2003 at 17:47 UTC | |
by Aristotle (Chancellor) on Dec 01, 2003 at 18:11 UTC |