From: dblack@... Date: 2005-12-08T06:33:14+09:00 Subject: Re: Newer to Ruby Hi -- On Thu, 8 Dec 2005, Derek Chesterfield wrote: > On 7 Dec 2005, at 8:47pm, Kwhamec Rojas wrote: > >> I need to be able to generate a random nine digit >> number. The first number cannot be 9,8 or 7. > > > rand(700000000) That won't always give you a nine-digit number (I'm assuming that starting with one or more 0's doesn't count... though it's not 100% clear). Since the useful range is 100000000 to 699999999, you could do: rand(599999999) + 100000000 David -- David A. Black dblack@wobblini.net "Ruby for Rails", forthcoming from Manning Publications, April 2006!