Sha256: acf4f1924541eebba7f533eb171b63cda1aeb85a2e26946edbe363589be29ec9

Contents?: true

Size: 545 Bytes

Versions: 14

Compression:

Stored size: 545 Bytes

Contents

Puppet::Parser::Functions::newfunction(:fqdn_rand, :type => :rvalue, :doc =>
  "Generates random numbers based on the node's fqdn. Generated random values
  will be a range from 0 up to and excluding n, where n is the first parameter.
  The second argument specifies a number to add to the seed and is optional, for example:

      $random_number = fqdn_rand(30)
      $random_number_seed = fqdn_rand(30,30)") do |args|
    require 'md5'
    max = args.shift
    srand MD5.new([lookupvar('fqdn'),args].join(':')).to_s.hex
    rand(max).to_s
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
puppet-2.6.18 lib/puppet/parser/functions/fqdn_rand.rb
puppet-2.6.17 lib/puppet/parser/functions/fqdn_rand.rb
puppet-2.6.16 lib/puppet/parser/functions/fqdn_rand.rb
puppet-2.6.15 lib/puppet/parser/functions/fqdn_rand.rb
puppet-2.6.14 lib/puppet/parser/functions/fqdn_rand.rb
puppet-2.6.13 lib/puppet/parser/functions/fqdn_rand.rb
puppet-2.6.12 lib/puppet/parser/functions/fqdn_rand.rb
puppet-2.6.11 lib/puppet/parser/functions/fqdn_rand.rb
puppet-2.6.10 lib/puppet/parser/functions/fqdn_rand.rb
puppet-2.6.9 lib/puppet/parser/functions/fqdn_rand.rb
puppet-2.6.8 lib/puppet/parser/functions/fqdn_rand.rb
puppet-2.6.7 lib/puppet/parser/functions/fqdn_rand.rb
puppet-2.6.6 lib/puppet/parser/functions/fqdn_rand.rb
puppet-2.6.5 lib/puppet/parser/functions/fqdn_rand.rb