Sha256: 20302d970a6f00c299c198894ba5ff1699bdaf367ea7569bfd7ff10442e725c5
Contents?: true
Size: 317 Bytes
Versions: 9
Compression:
Stored size: 317 Bytes
Contents
module Codebreaker class SecretCodeGenerator LENGTH = 4 RANGE = (1..6).freeze VALID_REGEXP = /^[#{RANGE.min}-#{RANGE.max}]{#{LENGTH}}$/.freeze def self.string_valid?(secret_code) VALID_REGEXP.match?(secret_code) end def call Array.new(LENGTH) { rand(RANGE) } end end end
Version data entries
9 entries across 9 versions & 1 rubygems