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