Steven Jenkins wrote: > Markus Roberts wrote: >> Mark Drayton made a good point >> (http://projects.reductivelabs.com/issues/2601#note-3); are we making >> the code more complicated than it needs to be to get less functionality >> than we might otherwise have? Rather than saying that it takes one >> additional numeric argument, why not just permit arbitrary additional >> seed values, like so: >> >> "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| >> max = args.shift >> srand MD5.new([lookupvar('fqdn'),args].join(':')).to_s.hex >> rand(max).to_s >> >> Specifically, is there any advantage to having a numeric offset to the >> seed? The practice is, in general, frowned upon at least insofar as >> small/constant numeric offsets don't add to the entropy and can result >> in a higher rate of collisions than adjusting the salt. >> > > I had some similar questions about this: my understanding (based on the irc > discussions) is that this function is really only used to distinguish among > hosts. Given that functionality, it seems the ability to modify the > seed/change > the string being randomized is only present when you have more than one host > in > your puppet environment that has a given IP address. > > In which case, either the current behavior or the suggestion above suffices.
Having a non-numeric seed possible is important to have independent random sequences for modules, i.e. "fqdn_rand($range, $modulename)" Regards, DavidS --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
