Signed-off-by: James Turnbull <[email protected]>
---
lib/puppet/parser/functions/fqdn_rand.rb | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/lib/puppet/parser/functions/fqdn_rand.rb
b/lib/puppet/parser/functions/fqdn_rand.rb
index 3e7018a..c287c4c 100644
--- a/lib/puppet/parser/functions/fqdn_rand.rb
+++ b/lib/puppet/parser/functions/fqdn_rand.rb
@@ -1,7 +1,12 @@
Puppet::Parser::Functions::newfunction(:fqdn_rand, :type => :rvalue, :doc =>
- "Generates random numbers based on the node's fqdn. The first argument
- sets the range. Additional (optional) arguments may be used to further
- distinguish the seed.") do |args|
+ "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
--
1.7.2.3
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-dev?hl=en.