% for i in {1..10000} ; do test $(( RANDOM % 2 )) -eq 1 && echo 1 ; done | wc -l
4985
$ for i in {1..10000} ; do test $(( RANDOM % 2 )) -eq 1 && echo 1 ; done | wc -l
5057
$ for i in {1..10000} ; do test $(( RANDOM % 2 )) -eq 1 && echo 1 ; done | wc -l
4940
$ for i in {1..10000} ; do test $(( RANDOM % 2 )) -eq 1 && echo 1 ; done | wc -l
5021
% for i in {1..10000} ; do test $(( RANDOM % 2 )) -eq 1 && echo 1 ; done | wc -l
4985
% for i in {1..10000} ; do test $(( RANDOM % 2 )) -eq 1 && echo 1 ; done | wc -l
4985
% for i in {1..10000} ; do test $(( RANDOM % 2 )) -eq 1 && echo 1 ; done | wc -l
4985
for i in {1..10000}; do echo $ ((RANDOM% 2)); done | awk '/ 1 / {N ++} END {print N}' for i in {1..10000}; do echo $ ((RANDOM% 2)); done> tmp_file && awk '/ 1 / {N ++} END {print N}' tmp_fileIt does the same thing - it considers the number of odd fallouts of RANDOM. By running the first of the same zsh session, we will get the same result, and the second will return a new one each time.
Source: https://habr.com/ru/post/101722/
All Articles