Locked lesson.
About this lesson
How to generate random numbers with Ruby.
Exercise files
Download this lesson’s related exercise files.
Random Numbers.docx59 KB Random Numbers - Solution.docx
59.1 KB
Quick reference
Random Numbers
Let's generate some random numbers!
When to use
Use this anytime you want to generate random numbers.
Instructions
To generate a random number in Ruby:
puts Random.rand(0..100)
Hints & tips
- puts Random.rand(0..100)
Lesson notes are only available for subscribers.