The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Ruby Haiku 137

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Rudi Cilibrasi

Posts: 25
Nickname: cilibrar
Registered: Aug, 2004

Rudi Cilibrasi is a longtime programmer and machine-learning researcher who loves Ruby
Ruby Haiku 137 Posted: Jan 26, 2005 6:54 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Rudi Cilibrasi.
Original Post: Ruby Haiku 137
Feed Title: Esoteric Ruby Blog
Feed URL: http://cilibrar.com/~cilibrar/erblog.cgi/index.rss
Feed Description: A weblog made to explore some Ruby ideas in great detail and try to work out ideal solutions to real problems.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Rudi Cilibrasi
Latest Posts From Esoteric Ruby Blog

Advertisement
class Array
  def scramble() dup.scramble! end                          # scramble v. 0.15
  def swap(i,j) self[i],self[j] = at(j),at(i) end           # by cilibrar
  def scramble!() each_index() { |i| swap(i,i+rand(size-i)) } end
end

Read: Ruby Haiku 137

Topic: in Berkeley, having fun Previous Topic   Next Topic Topic: Lotsa Code

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use