Bill Guindon
9/27/2004 8:56:00 PM
On Tue, 28 Sep 2004 05:13:30 +0900, STEPHEN BECKER I V
<becker004@gmail.com> wrote:
> Do each statements change the thing that they are using?
> data is a a string.
no, but map! and collect! do, but they only work on Arrays, not
Strings. So first, you'll need to split the string into an Array...
for strings, each_byte will do that.
srand(5000)
ndata = ''
a = data.size-1
data.each_byte do |c|
ndata += (((c-97)+rand(10))%26).chr
end
If you're looking for a random human readable string, you'll want to
bump it back up by 96 as you go along...
ndata += (((c-97)+rand(10))%26 + 97).chr
--
Bill Guindon (aka aGorilla)