randomness 0.0.4 → 0.0.6
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/main.rb +17 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56f73c5813f0942bc0c2362266dbfdfe7f5f2b96
|
4
|
+
data.tar.gz: 40910990af49a76fdb2106ae36c08c5bb1a1deb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19f5d7b560e6931f9e538552debda82d739f37cf862cd11fe77e9641145d44afd8382a51c323d3023488977de61821b4d8fd5f177c3141a8a8d7f50fd9d2cb72
|
7
|
+
data.tar.gz: d257dff2f50525dec8c0adaa5e346275cfc1e67b0acf6ed2ba4bff3c04287991d6d61fd2a44f4e5a8c199d4f8fb6e02d5b4e43d34f6148c4fb736b9ede56894b
|
data/lib/main.rb
CHANGED
@@ -31,8 +31,24 @@ module Randomness
|
|
31
31
|
end
|
32
32
|
return return_list
|
33
33
|
end
|
34
|
+
#Returns a random number of random elements from the provided list.
|
35
|
+
def randselection(list)
|
36
|
+
return randchoices(list, randint(1, list.size()))
|
37
|
+
end
|
34
38
|
#Returns a random word from a string.
|
35
39
|
def randword(string)
|
36
40
|
return randchoice(string.split(' '))
|
37
|
-
end
|
41
|
+
end
|
42
|
+
#Returns the specified amount of randomly chosen words.
|
43
|
+
def randwords(string, amount)
|
44
|
+
return randchoices(string.split(' '), amount)
|
45
|
+
end
|
46
|
+
#Returns a random character from a string.
|
47
|
+
def randchar(string)
|
48
|
+
return randchoice(string.split(''))
|
49
|
+
end
|
50
|
+
#Returns the specified amount of randomly chosen characters from the string.
|
51
|
+
def randchars(string, amount)
|
52
|
+
return randchoices(string.split(''), amount)
|
53
|
+
end
|
38
54
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: randomness
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SugarRush
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This is a small module containing several useful functions related to
|
14
14
|
random numbers.
|