forked from extern/nushell
91 lines
3.8 KiB
Markdown
91 lines
3.8 KiB
Markdown
# random
|
|
|
|
Use `random` to generate random values
|
|
|
|
## bool
|
|
|
|
* `random bool`: Generate a random boolean value
|
|
|
|
### bool Flags
|
|
|
|
* `-b`, `--bias` \<number>: Adjusts the probability of a "true" outcome
|
|
|
|
### bool Examples
|
|
|
|
```shell
|
|
> random bool
|
|
false
|
|
```
|
|
|
|
```shell
|
|
> random bool --bias 0.75
|
|
true
|
|
```
|
|
|
|
## dice
|
|
|
|
* `random dice`: Generate a random dice roll
|
|
|
|
### dice Flags
|
|
|
|
* `d`, `--dice` \<integer>: The amount of dice being rolled
|
|
* `s`, `--sides` \<integer>: The amount of sides a die has
|
|
|
|
### dice Examples
|
|
|
|
```shell
|
|
> random dice
|
|
4
|
|
```
|
|
|
|
```shell
|
|
> random dice -d 10 -s 12
|
|
───┬────
|
|
0 │ 11
|
|
1 │ 11
|
|
2 │ 11
|
|
3 │ 11
|
|
4 │ 5
|
|
5 │ 3
|
|
6 │ 10
|
|
7 │ 7
|
|
8 │ 3
|
|
9 │ 1
|
|
───┴────
|
|
```
|
|
|
|
```shell
|
|
> random dice --dice 1024 --sides 16 | wrap dice | histogram dice | sort-by count
|
|
────┬──────┬───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
# │ dice │ count │ frequency
|
|
────┼──────┼───────┼──────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
0 │ 15 │ 54 │ ***********************************************************************
|
|
1 │ 7 │ 55 │ ************************************************************************
|
|
2 │ 1 │ 56 │ *************************************************************************
|
|
3 │ 16 │ 57 │ ***************************************************************************
|
|
4 │ 5 │ 57 │ ***************************************************************************
|
|
5 │ 3 │ 61 │ ********************************************************************************
|
|
6 │ 11 │ 62 │ *********************************************************************************
|
|
7 │ 14 │ 64 │ ************************************************************************************
|
|
8 │ 9 │ 65 │ *************************************************************************************
|
|
9 │ 12 │ 66 │ **************************************************************************************
|
|
10 │ 4 │ 67 │ ****************************************************************************************
|
|
11 │ 2 │ 69 │ ******************************************************************************************
|
|
12 │ 8 │ 69 │ ******************************************************************************************
|
|
13 │ 6 │ 71 │ *********************************************************************************************
|
|
14 │ 13 │ 75 │ **************************************************************************************************
|
|
15 │ 10 │ 76 │ ****************************************************************************************************
|
|
────┴──────┴───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
```
|
|
|
|
## uuid
|
|
|
|
* `random uuid`: Generate a random uuid4 string
|
|
|
|
### uuid Examples
|
|
|
|
```shell
|
|
> random uuid
|
|
8af4de39-acbc-42f0-94d1-7cfad6c01f8b
|
|
```
|