James Gray
12/7/2005 8:51:00 PM
On Dec 7, 2005, at 2:47 PM, Kwhamec Rojas wrote:
> Hi. I am new to Ruby and new to programming altogether, but I am
> really
> trying to learn as fast as I can.
>
> So here's my problem: I need to be able to generate a random nine
> digit
> number. The first number cannot be 9,8 or 7.
>
> I am using Watir to test a site, but I will need to randomly generate
> this number or the test will be rejected. Thank you very much for
> whatever help you can give me.
See if this gives you some ideas:
>> digits = [rand(7)] + Array.new(8) { rand(10) }
=> [5, 6, 1, 2, 5, 4, 7, 1, 1]
James Edward Gray II