Sha256: d263e1b2aaa0608e5fd41e966632180a3bb20efa9f0f24ffdc7552ebf5fbfb4a

Contents?: true

Size: 457 Bytes

Versions: 1

Compression:

Stored size: 457 Bytes

Contents

module CatIpsum
  class Random
    def self.seed
      @seed ||= ::Random.new_seed
    end

    def self.seed=(value)
      @seed = value
      reset!
      value
    end

    def self.reset!
      @randomizer = randomize
      true
    end

    def self.randomizer
      @randomizer ||= randomize
    end

    def self.randomize
      ::Random.new(seed)
    end

    def self.sample(array)
      array.shuffle(random: randomizer).take(3)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cat_ipsum-0.2.1 lib/cat_ipsum/random.rb