From: Nobuyoshi Nakada Date: 2010-04-03T10:53:25+09:00 Subject: [ruby-core:29237] Re: [Bug #3027] Random#rand(nil) Hi, At Sun, 28 Mar 2010 09:06:57 +0900, Marc-Andre Lafortune wrote in [ruby-core:29075]: > Looking at Random#rand, I notice that passing nil has the > same result as not passing any argument. It comes from Kernel#rand. > 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) Agreed. For the backward compatibility, I'll keep Kernel#rand and added the documentation instead. -- Nobu Nakada