Random Numbers


Ruby comes with a random number generator. The method to get a randomly chosen number is rand. If you call rand, you'll get a float greater than or equal to 0.0 and less than 1.0. If you give it an integer parameter (by calling rand(5) ), you will get an integer value greater than or equal to 0 and less than 5.
Here's an example: p026phrase.rb

The above program makes three lists of words, and then randomly picks one word from each of the three lists and prints out the result.