> For the complete documentation index, see [llms.txt](https://alomancy.gitbook.io/guides/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://alomancy.gitbook.io/guides/cheat-sheets/bash-cheat-sheets/random.md).

# Random

## Random

### **Random generate password (e.g. generate 5 password each of length 13)**

```
sudo apt install pwgen
pwgen 13 5
#sahcahS9dah4a xieXaiJaey7xa UuMeo0ma7eic9 Ahpah9see3zai acerae7Huigh7
```

### **Random pick 100 lines from a file**

```
shuf -n 100 filename
```

### **Random order (lucky draw)**

```
for i in a b c d e; do echo $i; done | shuf
```

### **Echo series of random numbers between a range (e.g. shuffle numbers from 0-100, then pick 15 of them randomly)**

```
shuf -i 0-100 -n 15
```

### **Echo a random number**

```
echo $RANDOM
```

### **Random from 0-9**

```
echo $((RANDOM % 10))
```

### **Random from 1-10**

```
echo $(((RANDOM %10)+1))
```
