github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/docs/commands/rand.md (about)

     1  # `rand`
     2  
     3  > Random field generator
     4  
     5  ## Description
     6  
     7  `rand` can generate random numbers, strings and other data types.
     8  
     9  ## Usage
    10  
    11  ```
    12  rand data-type [ max-value ]
    13  ```
    14  
    15  ## Examples
    16  
    17  Random integer: 64-bit on 64-bit machines
    18  
    19  ```
    20  rand int
    21  ```
    22  
    23  Random integer between 0 and 9
    24  
    25  ```
    26  rand int 9
    27  ```
    28  
    29  Random floating point number between 0 and 1
    30  
    31  ```
    32  rand float
    33  ```
    34  
    35  Random string, fixed to 5 characters long
    36  
    37  ```
    38  rand str 5
    39  ```
    40  
    41  ## Flags
    42  
    43  * `*`
    44      Alias for **str** (string)
    45  * `float`
    46      Random floating point number between 0 and 1. **max-value** not supported
    47  * `int`
    48      Random integer, **max-value** specifies highest value for integer
    49  * `num`
    50      Alias for **int** in this builtin
    51  * `str`
    52      Random string of printable ASCII characters. **max-value** specifies the fixed length of the string
    53  
    54  ## Detail
    55  
    56  ### Security
    57  
    58  WARNING: is should be noted that while `rand` can produce random numbers and
    59  strings which might be useful for password generation, neither the RNG nor the
    60  the random string generator (which is ostensibly the same RNG but applied to an
    61  array of bytes within the range of printable ASCII characters) are considered
    62  cryptographically secure.
    63  
    64  ## See Also
    65  
    66  * [`format`](../commands/format.md):
    67    Reformat one data-type into another data-type
    68  * [`let`](../commands/let.md):
    69    Evaluate a mathematical function and assign to variable (deprecated)
    70  * [`set`](../commands/set.md):
    71    Define a local variable and set it's value
    72  
    73  <hr/>
    74  
    75  This document was generated from [builtins/core/random/rand_doc.yaml](https://github.com/lmorg/murex/blob/master/builtins/core/random/rand_doc.yaml).