Method: Symbol.random

Defined in:
lib/propr/random/symbol.rb

.random(options = {}, m = Propr::Random) ⇒ Object

@note: Beware of memory consumption. Symbols are never garbage collected, and we’re generating them at random!



5
6
7
8
9
10
11
12
# File 'lib/propr/random/symbol.rb', line 5

def random(options = {}, m = Propr::Random)
  min = options[:min] || 0
  max = options[:max] || 10
  options = Hash[charset: /[a-z_]/]
  m.bind(String.random(options)) do |s|
    m.unit(s.to_sym)
  end
end