jamiethehutt <jamie / annforfungi.co.uk> wrote:
> I'm a Ruby newbie and I'm wondering if there's a simple way to generate
> a random floating point number, I want to generate numbers between 0
> and about 2-3.6 with the max changing each time (an example max would
> be 3.26861475366199).
>
> I'm hoping there's something simpler than generating an integer
> (rand(3)) and then generating a point (rand(0.268)) and adding them
> together...

Calling Kernel.rand with no argument yields a random floating point
number n where (0 <= n < 1). So:

  my_number = rand * my_limit

...should help.

HTH,
Tim Hammerquist