Puppet Function: stdlib::seeded_rand
  
    - Defined in:
- 
      lib/puppet/functions/stdlib/seeded_rand.rb
    
    - Function type:
- Ruby 4.x API
 
  Summary
  Generates a random whole number greater than or equal to 0 and less than max, using the value of seed for repeatable randomness.
Overview
  
  
    
      
        stdlib::seeded_rand(Integer[1] $max, String $seed) ⇒ Integer 
      
    
  
  
  
  
  
    
      | 
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 | # File 'lib/puppet/functions/stdlib/seeded_rand.rb', line 5
Puppet::Functions.create_function(:'stdlib::seeded_rand') do
            dispatch :seeded_rand do
    param 'Integer[1]', :max
    param 'String', :seed
  end
  def seeded_rand(max, seed)
    require 'digest/md5'
    seed = Digest::MD5.hexdigest(seed).hex
    Puppet::Util.deterministic_rand_int(seed, max)
  end
end |