---
title: "ClikaRT::ops::randn"
sidebar_label: "randn"
description: "Standard-normal random tensor, N(0, 1). \\[ x \\sim \\mathcal{N}(0, 1) \\] shape the output shape (each extent a scalar or 0-D tensor). dtype output float dtype; default Float32."
---

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

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

## randn() {#randn}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`randn`**(<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::Float32`](../../index.md#DataType),<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`StreamOrDevice`](../StreamOrDevice.md) `device` `=` `{}`<br />
)

</div>

Standard-normal random tensor, `N(0, 1)`.

$$
x \sim \mathcal{N}(0, 1)
$$

**Parameters**

- `shape`: the output shape (each extent a scalar or 0-D tensor).
- `dtype`: output float dtype; default `Float32`.
- `device`: stream or device; default = the default device.

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

**Throws**

- `ClikaRT::Error`: (`INVALID_ARGUMENT`) on a non-float [`dtype`](../dtype/index.md).

```cpp
auto noise = ClikaRT::ops::randn({batch, dim});
```

<div class="api-declared">

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

</div>
