From 6311d72ab8c7399fd7439c642fb3d5b85df013a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Kn=C3=B6ppler?= <6317548+theCalcaholic@users.noreply.github.com> Date: Wed, 27 Sep 2023 17:59:47 +0200 Subject: [PATCH] Add utility_script generate_cohortes.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com> --- generate_cohortes.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 generate_cohortes.sh diff --git a/generate_cohortes.sh b/generate_cohortes.sh new file mode 100755 index 00000000..1f44df04 --- /dev/null +++ b/generate_cohortes.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +#min=$((101-${1:-50})) +all=({100..1}) +cohortes=() +for i in ${all[@]:0:$1} +do + cohorte_id=$((RANDOM % i)) + while [[ " ${cohortes[*]} " =~ .*" ${cohorte_id} ".* ]] + do + cohorte_id=$((cohorte_id+1)) + done + cohortes+=($cohorte_id) +done + +echo "${cohortes[*]}" | tr ' ' $'\n'