Generating random odd integer

hi
how can i generate random odd integers?
i want it to refer to user.id
thanks

Am 09.07.2009 um 13:20 schrieb Ghazal M.:

how can i generate random odd integers?

Something like: 2 * rand(6) + 1 ? The example will give you an odd
number between 1 and 11 (both included). Adapt the number in rand as
needed.

More details here http://ruby-doc.org/core/classes/Kernel.html#M005974

As a side note: Google is your friend.

Felix

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs