---
title: "randomUniformTensor(withShape:name:)"
framework: metalperformanceshadersgraph
role: symbol
role_heading: Instance Method
path: "metalperformanceshadersgraph/mpsgraph/randomuniformtensor(withshape:name:)"
---

# randomUniformTensor(withShape:name:)

Creates a RandomUniform operation and returns random uniform values

## Declaration

```swift
func randomUniformTensor(withShape shape: [NSNumber], name: String?) -> MPSGraphTensor
```

## Parameters

- `shape`: The shape of the tensor generated
- `name`: The name for the operation.

## Return Value

Return Value An MPSGraphTensor of shape containing random values in the defined range.

## Discussion

Discussion Returns a tensor of provided shape of random uniform values in the range [0.0, 1.0). Uses a random seed value to initalize state. No state is preserved, and subsequent calls are not guaranteed to result in a unique stream of random values.
