Add utility_script generate_cohortes.sh

Signed-off-by: Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com>
This commit is contained in:
Tobias Knöppler 2023-09-27 17:59:47 +02:00
parent 46d33f7698
commit 6311d72ab8
No known key found for this signature in database
GPG Key ID: 3510056072886A8F

16
generate_cohortes.sh Executable file
View File

@ -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'