nope Z:/ruby/vernam.rb:26:in `encrypt': undefined method `map!' for "abcdefghijklmnop":String (NoMethodE rror) from Z:/ruby/vernam.rb:38 Press any key to continue . . . On Tue, 28 Sep 2004 05:22:54 +0900, James Edward Gray II <james / grayproductions.net> wrote: > > > On Sep 27, 2004, at 3:13 PM, STEPHEN BECKER I V wrote: > > > Do each statements change the thing that they are using? > > data is a a string. > > ##code > > > > ndata=data.clone > > a = ndata.size-1 > > srand(5000) > > ndata.each do |c| > > c=((c-97)+rand(10))%26 > > end > > ## code > > > > So ndata indexes are not change? Am i doing this wrong (well i know > > its not working so it cant be right.)? I have it working with a while > > loop but i am trying to teach my self the ruby way. > > How about using: > > ndata.map! do |c| > ((c-97)+rand(10))%26 > end > > Does that do it? > > James Edward Gray II > >