# NextInt

> Returns a uniformly random int value in the interval [-2147483647, 2147483647].

## Definition

* **Type:** Method
* **Namespace:** [Unity.Mathematics](/engine/6000.7/script-reference/unity/mathematics.md)
* **Assembly:** UnityEngine.MathematicsModule

## NextInt()

Returns a uniformly random int value in the interval \[-2147483647, 2147483647].

```csharp
public int NextInt()
```

### Returns

| Type                                                       | Description                       |
| ---------------------------------------------------------- | --------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | A uniformly random integer value. |

## NextInt(int)

Returns a uniformly random int value in the interval \[0, max).

```csharp
public int NextInt(int max)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The maximum value to generate, exclusive.

### Returns

| Type                                                       | Description                                          |
| ---------------------------------------------------------- | ---------------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | A uniformly random int value in the range \[0, max). |

## NextInt(int, int)

Returns a uniformly random int value in the interval \[min, max).

```csharp
public int NextInt(int min, int max)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The minimum value to generate, inclusive.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The maximum value to generate, exclusive.

### Returns

| Type                                                       | Description                                     |
| ---------------------------------------------------------- | ----------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | A uniformly random integer between \[min, max). |
