Sha256: 2b23fc24b282feb7e9d3ac87cdcc739cd9851e5e628eb7acb1c62422dd6ed573

Contents?: true

Size: 831 Bytes

Versions: 1

Compression:

Stored size: 831 Bytes

Contents

# Author::    Nicolas Pouillard  <ertai@lrde.epita.fr>.
# Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
# License::   GNU General Public License (GPL).
# Revision::  $Id: random_generator.rb 218 2005-05-09 12:11:21Z ertai $

module RandomGenerators

  class RandomGenerator
    abstract

    def check_choose_integer ( n )
      unless n.is_a? Integer
        raise ArgumentError, "Need an integer (not #{n})"
      end
      if n <= 0
        raise ArgumentError, "Need an positive value (not #{n})"
      end
    end

    def check_choose_float ( f )
      unless f.is_a? Float
        raise ArgumentError, "Need a float (not #{f})"
      end
      if f <= 0
        raise ArgumentError, "Need an positive value (not #{f})"
      end
    end

  end # class RandomGenerator

end # module RandomGenerators

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vcs-0.2.148 ruby_ex/random_generators/random_generator.rb