Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Create A Random Number In Ruby

DZone's Guide to

Create A Random Number In Ruby

·
Free Resource
Return a value from 0 to 5:
rand(6)

Return a value between 0 and 1:
rand

Resources:
 - Module: Kernel [ruby-doc.org]
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}