Permalink
Browse files

Fixed rand for older versions of ruby

  • Loading branch information...
1 parent 83fa2ed commit addfb229bf74a1d828e794cd394ace11f310dc78 @hemanth committed May 23, 2012
Showing with 2 additions and 2 deletions.
  1. +1 −1 lib/xkcd.rb
  2. +1 −1 xkcd.gemspec
View
@@ -32,7 +32,7 @@ def self.img
=end
def self.img
max = JSON.parse(open('http://xkcd.com/info.0.json').read)["num"]
- comic_num = Random.rand(max)
+ comic_num = 1 + rand(max-1)
comic_num = 1 if comic_num == 404 # Avoid 404th comic ;)
comic = JSON.parse(open("http://xkcd.com/#{comic_num}/info.0.json").read)
"#{comic['alt']} : #{comic['img']}"
View
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = "xkcd"
- s.version = "0.0.9"
+ s.version = "1.0.1"
s.default_executable = "xkcd"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=

0 comments on commit addfb22

Please sign in to comment.