--1926193751-1899886704-1232562830379
Content-Type: MULTIPART/MIXED; BOUNDARY="1926193751-1899886704-1232562830=:1379"

  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--1926193751-1899886704-1232562830379
Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE

Hi --

On Thu, 22 Jan 2009, jko170 wrote:

> On Jan 20, 5:19   
>> jko170 wrote:
>>> On Jan 19, 10:05 pm, James Gray <ja... / grayproductions.net> wrote:
>>>> On Jan 19, 2009, at 9:58 PM, jko170 wrote:
>>
>>>>> How can I get an array of 10 numbers in between two numbers?
>>>>> (1..500).to_a
>>>> I guess it depends on which ten numbers you want, but here's one way:
>>
>>>> > (1..500).enum_for(:step, 50).to_a
>>>> => [1, 51, 101, 151, 201, 251, 301, 351, 401, 451]
>>
>>>> James Edward Gray II
>>
>>> Yeah, the end numbers need to be included in the array of 10.
>>
>> Requirements: 10 numbers, evenly distributed, first and last numbers in
>> the array.
>>
>> require 'pp'
>>
>> first, last = ARGV[0].to_f, ARGV[1].to_f
>> numbers = []
>> incr = (last - first) / 9.0
>> n = first
>> 10.times do
>>    >>    
>> end
>> pp numbers
>>
>> --
>> RMagick:http://rmagick.rubyforge.org/
>
> Thank you very much Tim! Works perfectly.

Awww, you didn't say the final array didn't have to contain integers
:-)


David

-- 
David A. Black / Ruby Power and Light, LLC
Ruby/Rails consulting & training: http://www.rubypal.com
Coming in 2009: The Well-Grounded Rubyist (http://manning.com/black2)

http://www.wishsight.com => Independent, social wishlist management!
--1926193751-1899886704-1232562830379--
--1926193751-1899886704-1232562830379--