On 10/30/06, James Edward Gray II <james / grayproductions.net> wrote:
> On Oct 29, 2006, at 6:34 PM, Robert Conn wrote:
>
> >     # Decide whether to go forward or back 5 mins
> >     if rand(2) == 1
> >       @display = @actual + (5 * 60)
> >     else
> >       @display = @actual - (5 * 60)
> >     end
>
>
> You could shorten that up a bit, though I'm not sure this is as
> readable:
>
> @display = @actual.send(%w[+ -][rand(2)], 5 * 60)

I usually do something like @display = @actual + (5*60)*(1 - rand(2)*2)

martin