Grimoire-
Command
.es

GNU+Linux command memo

Generate random numbers with 'n' digits

shell Python code

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)]))"

Selection

  • Check SSD remaining lifetime
  • Save data from lost partition
  • Cipher external Android SDcard
  • Recommanded Firefox addons
  • doc_crawler.py : Extract site PDFs
  • 20 mémos "ligne de commande"
  • [Mémo 8] compression de fichiers
  • [Mémo 10] explorer le matériel
  • Tectonique de la pâte thermique
  • Doc. AsciiDoctor en français
  Articles | Command.es | Mémos

Themes  

  • Artix
  • Debian
  • Fairphone
  • Firefox
  • Git
  • JavaScript
  • KVM
  • Memo
  • Nim
  • Python
  • SSH
  • Tor
  • Xorg
  • adminsys
  • android
  • asciidoc
  • benchmark
  • bluetooth
  • code
  • comfort
  • compression
  • database
  • date
  • game
  • hardware
  • install
  • metadata
  • mount
  • music
  • mutt
  • network
  • optimize
  • regex
  • repair
  • security
  • shell
  • storage
  • vim

Sponsor

Meta-Press.es: search-engine

Liberapay   Patreon

Support via BTC 12z7pK5YFcmG7PGJ985dFtnRzwtxDVDmwc

A propos  Flux