Class: Random

Inherits:
Object show all
Defined in:
lib/standard/facets/random.rb

Overview

Randomization Extensions

This library extends Array, String, Hash and other classes with randomization methods.

Credit for this work is due to:

  • Ilmari Heikkinen

  • Christian Neukirchen

  • Thomas Sawyer

Defined Under Namespace

Modules: ArrayExtensions, HashExtensions, IntegerExtensions, NumericExtensions, RangeExtensions, StringExtensions

Class Method Summary collapse

Class Method Details

.letterObject

Module method to generate a random letter.

Random.letter  #~> "q"
Random.letter  #~> "r"
Random.letter  #~> "a"


31
32
33
# File 'lib/standard/facets/random.rb', line 31

def self.letter
  (Random.number(26) + (Random.number(2) == 0 ? 65 : 97) ).chr
end