Sha256: 17d8ad848593e4261978d2155efc48c8f6cd9a07a00ee421995ebb2eb231468b
Contents?: true
Size: 779 Bytes
Versions: 6
Compression:
Stored size: 779 Bytes
Contents
# frozen_string_literal: true module Pbt module Check # Module to be included in classes that need to generate values to test. module Tosser # Generate values. # # @param arb [Arbitrary] Arbitrary to generate a value. # @param seed [Integer] Random number generator's seed. # @return [Enumerator] def toss(arb, seed) Enumerator.new do |enum| rng = Random.new(seed) loop do enum.yield toss_next(arb, rng) end end end private # Generate next value. # # @param arb [Arbitrary] Arbitrary to generate a value. # @param rng [Random] Random number generator. def toss_next(arb, rng) arb.generate(rng) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems