Skip to content

Commit b3175f1

Browse files
Update README.md
1 parent ac45ae4 commit b3175f1

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
</div>
55
<br><br>
66

7-
**Gnu-linux-shell-scripting** is a foundation for shell scripting in the GNU/Linux environment.
7+
**Gnu-linux-shell-scripting** is a foundation for shell scripting in GNU/Linux.
88

99
It is made up of the following four types of solutions:
1010

@@ -13,9 +13,9 @@ It is made up of the following four types of solutions:
1313
3. One-liners
1414
4. Aliases
1515

16-
# Paradigms
16+
# Categories
1717

18-
Here is a list of all the paradigms with a few examples in which all solutions exist:
18+
Here is a list of all the categories with a few examples in each:
1919

2020
## Application management
2121

@@ -75,5 +75,5 @@ Here is a list of all the paradigms with a few examples in which all solutions e
7575

7676
# Code style guidelines
7777

78-
All the solutions in this repository follow [these](https://github.com/computingfoundation/gnu-linux-shell-scripting/wiki) standard guidelines.
78+
All the solutions in this repository follow [this](https://github.com/computingfoundation/gnu-linux-shell-scripting/wiki) standard guideline.
7979

functions_scripts/scripting/bash/numberutils.bash

+12-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,18 @@ generateRandomNumber() {
3333
[ "$#" -ne 2 ] && return 1
3434
[[ "${1}" =~ ^[0-9]+$ && "${2}" =~ ^[0-9]+$ ]] || return 1
3535
[ "${1}" -gt "${2}" ] && return 1
36-
echo $(( ( RANDOM % ( "${2}" - "${1}" + 1 ) + "${1}" )))
36+
printf '%s' $(( ( RANDOM % ( "${2}" - "${1}" + 1 ) + "${1}" )))
37+
}
38+
39+
# Generate a random decimal between ".00" and ".99".
40+
# Usage:
41+
# generateRandomDecimal
42+
function generateRandomDecimal {
43+
[ "$#" -ne 2 ] && return 1
44+
[[ "${1}" =~ ^[0-9]+\.[0-9]+$ && "${2}" =~ ^[0-9]+\.[0-9]+$ ]] || return 1
45+
out=$(bc <<< "scale=2; $(printf '0.%02d' $(( $RANDOM % 100))) / 2")
46+
if [ "${out}" = '0' ]; then out='.00'; fi
47+
printf '%s' "${out}"
3748
}
3849

3950

0 commit comments

Comments
 (0)