# NextDouble2

> Returns a uniformly random double2 value with all components in the interval [0, 1).

## Definition

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

## NextDouble2()

Returns a uniformly random double2 value with all components in the interval \[0, 1).

```csharp
public double2 NextDouble2()
```

### Returns

| Type                                                                    | Description                                            |
| ----------------------------------------------------------------------- | ------------------------------------------------------ |
| [double2](/engine/6000.7/script-reference/unity/mathematics/double2.md) | A uniformly random double2 value in the range \[0, 1). |

## NextDouble2(double2)

Returns a uniformly random double2 value with all components in the interval \[0, max).

```csharp
public double2 NextDouble2(double2 max)
```

### Parameters

**** (\[double2]\(/engine/6000.7/script-reference/unity/mathematics/double2)): The componentwise maximum value to generate, exclusive.

### Returns

| Type                                                                    | Description                                              |
| ----------------------------------------------------------------------- | -------------------------------------------------------- |
| [double2](/engine/6000.7/script-reference/unity/mathematics/double2.md) | A uniformly random double2 value in the range \[0, max). |

## NextDouble2(double2, double2)

Returns a uniformly random double2 value with all components in the interval \[min, max).

```csharp
public double2 NextDouble2(double2 min, double2 max)
```

### Parameters

**** (\[double2]\(/engine/6000.7/script-reference/unity/mathematics/double2)): The componentwise minimum value to generate, inclusive.**** (\[double2]\(/engine/6000.7/script-reference/unity/mathematics/double2)): The componentwise maximum value to generate, exclusive.

### Returns

| Type                                                                    | Description                                                |
| ----------------------------------------------------------------------- | ---------------------------------------------------------- |
| [double2](/engine/6000.7/script-reference/unity/mathematics/double2.md) | A uniformly random double2 value in the range \[min, max). |

### Remarks

Each component is computed as `NextDouble() * (max - min) + min`, so floating-point rounding can in rare cases return a component equal to the corresponding component of `max` rather than strictly less than it. Clamp the result if you require components strictly less than `max`.
