---
title: "ClikaRT::ops::random_"
sidebar_label: "random_"
description: "In-place uniform-INTEGER fill: overwrites self with draws from [low, high). low and high come both or neither; with both absent, the range is the dtype's full representable-integer span."
---

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

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

## random\_() {#random_}

<div class="api-signature">

[`Tensor`](../Tensor.md)`&` **`random_`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md)`&` `self`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::optional<std::int64_t>` `low` `=` `std::nullopt`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::optional<std::int64_t>` `high` `=` `std::nullopt`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`StreamOrDevice`](../StreamOrDevice.md) `device` `=` `{}`<br />
)

</div>

In-place uniform-INTEGER fill: overwrites `self` with draws from `[low, high)`. `low` and `high` come both or neither; with both absent, the range is the dtype's full representable-integer span. A view input writes through its base storage. Returns `self` for chaining.

**Throws**

- `ClikaRT::Error`: (`INVALID_ARGUMENT`) when exactly one bound is given (`code_name()` carries the reason).

<div class="api-declared">

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

</div>
