From: Josh Cheek Date: 2010-09-07T18:31:35+09:00 Subject: Re: Dice Roller --0016363b9f7e0d80a2048fa81012 Content-Type: text/plain; charset=ISO-8859-1 On Tue, Sep 7, 2010 at 4:03 AM, vadivelan K wrote: > Thanks Brian for pointed out this. Yes it will returns the value bw 0 and 4 > suits for 5-sided die. > > We can use this > > puts "Roll #{n+1}: #{1 + rand(7-1)}" > > This way we can get the values between 0 to 6 as final result. > > > You will get values 1 through 6 (Isn't that why you added the 1?) Also, seven minus one is six, so why the superfluous math? (0..1000).map { 1 + rand(6) }.uniq.sort # => [1, 2, 3, 4, 5, 6] --0016363b9f7e0d80a2048fa81012--