From: Bill Guindon Date: 2004-09-28T05:55:34+09:00 Subject: Re: {newb} Each statements On Tue, 28 Sep 2004 05:13:30 +0900, STEPHEN BECKER I V 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)