Parameters to rand

The pickaxe states that rand first converts its parameter “p” to an integer
using “p.to_i.abs”.

This doesn’t actually seem to be happening, though. It looks like rand will
only convert Floats to integers. Is there a reason rand doesn’t just call
"to_i"?

Chris

Hi,

···

In message “parameters to rand” on 02/12/10, “Chris Pine” nemo@hellotree.com writes:

The pickaxe states that rand first converts its parameter “p” to an integer
using “p.to_i.abs”.

This doesn’t actually seem to be happening, though. It looks like rand will
only convert Floats to integers. Is there a reason rand doesn’t just call
“to_i”?

Implicit integer conversion is done by “to_int”.

						matz.