Created
September 4, 2015 20:40
-
-
Save jmhbrown/04a2e292e9ae973f9991 to your computer and use it in GitHub Desktop.
reorder based on fqdn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reorders an array based on a node's FQDN | |
# | |
# @param [String] fqdn server's fully qualified domain name | |
# @param [Array] array An array that needs reordering | |
# @returns [Array] A reordered copy of the provided array | |
def reorder_based_on_fqdn(fqdn, array) | |
rng = Random.new(Digest::MD5.hexdigest(fqdn).hex) | |
array.shuffle(random: rng) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment