---
title: "ClikaRT::ops::randint"
sidebar_label: "randint"
description: "Uniform random integers in the half-open range [low, high). low inclusive lower bound. high EXCLUSIVE upper bound; must exceed low. shape the output shape. dtype output integer dtype; default Int64."
---

<!-- Generated by tools/doxygen2mdx from Doxygen XML. Do not edit. -->

<span class="api-kind api-kind--function">function</span>

## randint() {#randint}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`randint`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;`int64_t` `low`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`int64_t` `high`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`ClikaRT::Span`](../Span.md)`<const` [`ScalarOrTensor`](../ScalarOrTensor.md)`>` `shape`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`DataType`](../../index.md#DataType) `dtype` `=` [`DataType::Int64`](../../index.md#DataType),<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`StreamOrDevice`](../StreamOrDevice.md) `device` `=` `{}`<br />
)

</div>

Uniform random integers in the half-open range `[low, high)`.

**Parameters**

- `low`: inclusive lower bound.
- `high`: EXCLUSIVE upper bound; must exceed `low`.
- `shape`: the output shape.
- `dtype`: output integer dtype; default `Int64`.
- `device`: stream or device; default = the default device.

**Returns:** a [`shape`](./shape.md#shape)-shaped integer tensor.

**Throws**

- `ClikaRT::Error`: (`INVALID_ARGUMENT`) when `high <= low` or the range does not fit [`dtype`](../dtype/index.md).

<div class="api-declared">

Declared in `ClikaRT/compute/ops.h`, line 4207

</div>
