From: Marc-Andre Lafortune Date: 2010-03-28T09:06:57+09:00 Subject: [ruby-core:29075] [Bug #3027] Random#rand(nil) Bug #3027: Random#rand(nil) http://redmine.ruby-lang.org/issues/show/3027 Author: Marc-Andre Lafortune Status: Open, Priority: Normal Assigned to: Nobuyoshi Nakada, Category: core, Target version: 1.9.2 ruby -v: ruby 1.9.2dev (2010-03-03 trunk 26805) [x86_64-darwin10.2.0] Hi Nobu. Looking at Random#rand, I notice that passing nil has the same result as not passing any argument. Either it should raise an ArgumentError like the documentation implies, or else the documentation should be modified. I would argue to raise an error because: - it is easy to pass nothing, or pass 1.0 instead, and get the same result if that is what is desired - it could hide an error in the code, where the result is unexpectedly nil but the programmer didn't think about it (like whiny nils in rails) ---------------------------------------- http://redmine.ruby-lang.org