All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gems.sass-3.4.19.lib.sass.util.cross_platform_random.rb Maven / Gradle / Ivy

There is a newer version: 3.7.2
Show newest version
module Sass
  module Util
    # Ruby 1.8 doesn't support an actual Random class with a settable seed.
    class CrossPlatformRandom
      def initialize(seed = nil)
        if Sass::Util.ruby1_8?
          srand(seed) if seed
        else
          @random = seed ? ::Random.new(seed) : ::Random.new
        end
      end

      def rand(*args)
        return @random.rand(*args) if @random
        Kernel.rand(*args)
      end
    end
  end
end




© 2015 - 2025 Weber Informatics LLC | Privacy Policy