randomness 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/changelog.txt +5 -2
- data/lib/main.rb +16 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75b5ce6577df05e0f4a4ef51eb947c412bd750bf
|
4
|
+
data.tar.gz: 5e884abaa0a40824eb6bb2dc596b245e395080ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfe6e7237ed4a09728e4449cf8710d0c5f14a9db3e559b6746a26bb369e8032974c94756d262e7e26fac58bce3c0108cf6f9115ff51b9eebc2a0ab2bf437de80
|
7
|
+
data.tar.gz: ea819c2fee04d0dd17b9f9280f2c9f929e85c3c002d85a5fafc8730243fff5c064516bc1aa4fb9cd2fe5d2b64662dac5abff45b3a543e586ea641727823d2b44
|
data/lib/changelog.txt
CHANGED
data/lib/main.rb
CHANGED
@@ -65,4 +65,20 @@ module Randomness
|
|
65
65
|
end
|
66
66
|
return return_list
|
67
67
|
end
|
68
|
+
#Returns a random key from the given hash.
|
69
|
+
def randhashkey(hash)
|
70
|
+
return randchoice(hash.keys())
|
71
|
+
end
|
72
|
+
#Returns the specified amount of random hash keys.
|
73
|
+
def randhashkeys(hash, amount)
|
74
|
+
return randchoices(hash.keys(), amount)
|
75
|
+
end
|
76
|
+
#Returns a random value from the given hash.
|
77
|
+
def randhashvalue(hash)
|
78
|
+
return randchoice(hash.values())
|
79
|
+
end
|
80
|
+
#Returns the specified amount of random values from the given hash.
|
81
|
+
def randhashvalues(hash, amount)
|
82
|
+
return randchoices(hash.values(), amount)
|
83
|
+
end
|
68
84
|
end
|