class Sass::Util::CrossPlatformRandom - sass-3.4.14 Documentation

# class Sass::Util::CrossPlatformRandom

Ruby 1.8 doesn't support an actual Random class with a settable seed.

### Public Class Methods

new(seed = nil) click to toggle source

    # File lib/sass/util/cross_platform_random.rb, line 5
    def initialize(seed = nil)
      if Sass::Util.ruby1_8?
        srand(seed) if seed
      else
        @random = seed ? ::Random.new(seed) : ::Random.new
      end
    end

### Public Instance Methods

rand(*args) click to toggle source

    # File lib/sass/util/cross_platform_random.rb, line 13
    def rand(*args)
      return @random.rand(*args) if @random
      Kernel.rand(*args)
    end