Générer un nombre aléatoire de 'n' chiffres
In a terminal :
$ cat /dev/urandom | tr -cd '0-9' | head -c $n
In a JavaScript console :
function rnd (n) { return Math.ceil (Math.random () * Math.pow (10, n)); }
Via Python :
import random; print(''.join([str(random.randint(0, 9)) for _ in range(n)])) (1)
1 | Can be called from a terminal via : python3 -c "import random; print(''.join([str(random.randint(0, 9)) for _ in range(n)]))" |