> For the complete documentation index, see [llms.txt](https://docs.ask.edvard.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ask.edvard.dev/built-in-utilities/random-generators.md).

# Random Generators

Use the different methods of the built-in `random` object for this.

## `Int()`

```python
random.int(min, max, count)
```

### Parameters

{% tabs %}
{% tab title="Min" %}

* An integer.
* The start of the range.
  {% endtab %}

{% tab title="Max" %}

* An integer.
* The end of the range.
  {% endtab %}

{% tab title="Count (optional)" %}

* Optional parameter (default is 1)
* How many random numbers to generate.
* An integer.
  {% endtab %}
  {% endtabs %}

## `Float()`

```python
random.float(min, max, count, decimals, unique)
```

### Parameters

{% tabs %}
{% tab title="Min" %}

* A float.
* The start of the range.
  {% endtab %}

{% tab title="Max" %}

* A float.
* The end of the range.
  {% endtab %}

{% tab title="Count (optional)" %}

* Optional parameter (default is 1)
* How many random numbers to generate.
* An integer.
  {% endtab %}

{% tab title="Decimals (optional)" %}

* Optional parameter (default is 16)
* How many decimals (max) to include.
  {% endtab %}

{% tab title="Unique (optional)" %}

* A boolean (True/False).
* Should the numbers generated be unique?
  {% endtab %}
  {% endtabs %}

## `Element()`

```python
random.element(iterable, count, weights, unique)
```

### Parameters

{% tabs %}
{% tab title="Iterable" %}

* The iterable to get random elements from.
* E.g. a list.
  {% endtab %}

{% tab title="Count (optional)" %}

* Optional parameter (default is 1)
* How many random choices/elements to generate.
* An integer.
  {% endtab %}

{% tab title="Weights (optional)" %}

* Optional weights for the generation.
* A list.
  {% endtab %}

{% tab title="Unique (optional)" %}

* A boolean (True/False).
* Should the generated choices/elements be unique?
  {% endtab %}
  {% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ask.edvard.dev/built-in-utilities/random-generators.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
