#!/bin/bash
servers="server1;server2;server3"
IFS=';' read -r -a array <<< "$servers"
rand=$[ $RANDOM % ${#array[@]} ]
echo ${array[$rand]}
To run this inside a container, you have to docker run --privileged
You can run this on host, then map /dev/random from host inside container
/!\ In test environment ONLY :
Don't install anything, just map /dev/urandom from host into /dev/random container
docker run -v /dev/urandom:/dev/random
Test entropy : (rng-tools)
cat /dev/random | rngtest -c 1000
sleep $(shuf -i 1-600 -n 1) && /bin/gogo
Algo pour faire du random avec poids