Sha256: 0f61b1cadfea7fe46b7bde2dd912fdecc58c48817fbf86b37c6e90ea83f3624e

Contents?: true

Size: 769 Bytes

Versions: 9

Compression:

Stored size: 769 Bytes

Contents

module VGen
  class TypicalLetterGen
    def call
      table = {
        0...816=>"a", 816...965=>"b", 965...1243=>"c",
        1243...1668=>"d", 1668...2938=>"e", 2938...3160=>"f",
        3160...3361=>"g", 3361...3970=>"h", 3970...4666=>"i",
        4666...4681=>"j", 4681...4758=>"k", 4758...5160=>"l",
        5160...5400=>"m", 5400...6074=>"n", 6074...6824=>"o",
        6824...7016=>"p", 7016...7025=>"q", 7025...7623=>"r",
        7623...8255=>"s", 8255...9160=>"t", 9160...9435=>"u",
        9435...9532=>"v", 9532...9768=>"w", 9768...9783=>"x",
        9783...9980=>"y", 9980...9987=>"z"
      }
      i = Random.new.rand(0...9987)
      table.each do |range, letter|
        return letter if range.include? i
      end
    end
  end
end

Version data entries

9 entries across 7 versions & 2 rubygems

Version Path
bsielski_control_flow-1.0.0 vendor/bundle/ruby/2.5.0/gems/bsielski_value_generator-1.4.0/lib/v_gen/typical_letter_gen.rb
bsielski_control_flow-1.0.0 vendor/bundle/ruby/2.5.0/gems/bsielski_value_generator-1.3.0/lib/v_gen/typical_letter_gen.rb
bsielski_control_flow-1.0.0 vendor/bundle/ruby/2.5.0/gems/bsielski_value_generator-1.2.0/lib/bsielski_v_gen/typical_letter_gen.rb
bsielski_value_generator-1.4.0 lib/v_gen/typical_letter_gen.rb
bsielski_value_generator-1.3.0 lib/v_gen/typical_letter_gen.rb
bsielski_value_generator-1.2.0 lib/bsielski_v_gen/typical_letter_gen.rb
bsielski_value_generator-1.1.0 lib/bsielski_v_gen/typical_letter_gen.rb
bsielski_value_generator-1.0.1 lib/bsielski_v_gen/typical_letter_gen.rb
bsielski_value_generator-1.0.0 lib/bsielski_v_gen/typical_letter_gen.rb