This Bash script shuffles an array of numbers from 1 to 10 and outputs them in a random order.
There is no build required for this script. To use it, follow the Usage instructions below.
- Clone or download the script file
shuffle_numbers.sh
to your local machine. - Ensure the script has execute permissions:
chmod +x shuffle_numbers.sh
- Run the script in a terminal:
./shuffle_numbers.sh
The tests for this script are available in the test.bash
file. To execute the tests, follow these steps:
- Ensure both
shuffle_numbers.sh
andtest.bash
are in the same directory. - Make sure both files have execute permissions:
chmod +x shuffle_numbers.sh test.bash
- Run the tests using the following command:
./test.bash
The script employs a Fisher-Yates shuffling algorithm to randomize the order of numbers from 1 to 10 in a Bash environment. It defines a function to generate a random number within a specified range and shuffles the numbers array to produce a randomized sequence.
- Uses the RANDOM variable, which generates pseudorandom numbers and may not be suitable for cryptographic applications or high-security randomization.
- In rare cases, the script might take longer to execute if the shuffling algorithm encounters repeated random selections. However, for small arrays like 1 to 10, this is highly unlikely.
-
Request Rate,
-
Request Latency
-
Error Count are the most beneficial metrics , find to monitor on the web server side. Additionally, tracking the following metrics would be interesting to gauge the server's capacity and measure the load accurately:
-
CPU Utilization
-
Memory Usage
-
Memory Utilization
-
Memory Fragmentation
-
Network Usage
-
Packet Losses
-
Disk I/O
To collect both metric groups, I can use a tool like Prometheus + Grafana or Zabbix. The metrics we will be tracking here are quite general, so I don't anticipate facing any difficulties. However, if I consider not finding a ready-made template or node exporter, and if I have to write them myself, fetching the metrics correctly could be challenging and time-consuming