Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .yamato/upm-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,16 @@ upmci_platforms:
flavor: b1.large

validate_editor_versions:
- version: "2022.3"
display_name: "2022.3"
- version: "6000.0"
display_name: "6000.0"
- version: "6000.3"
display_name: "6000.3"
- version: "6000.4"
display_name: "6000.4"

package_tests_editor_versions:
- version: "2022.3"
display_name: "2022.3"
- version: "6000.0"
display_name: "6000.0"
- version: "6000.3"
display_name: "6000.3"
- version: "6000.4"
display_name: "6000.4"
---

{% for platform in upmci_platforms %}
Expand Down
4 changes: 4 additions & 0 deletions src/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Changelog

## [Unreleased]
* Added a documentation remark for Random NextFloat and NextDouble methods with a min and max parameter.

## [1.3.2] - 2024-01-11

### Fixed
* Fixed `math.hash` crash when using IL2CPP builds on Arm 32 bit devices.
* Fixed obsolete method usage warnings for `MatrixDrawer.CanCacheInspectorGUI` and `PrimitiveVectorDrawer.CanCacheInspectorGUI` in UNITY_2023_2_OR_NEWER.
* Updated minimum editor version to 2021.3

## [1.3.1] - 2023-07-12

Expand Down
8 changes: 8 additions & 0 deletions src/Unity.Mathematics/random.cs
Original file line number Diff line number Diff line change
Expand Up @@ -468,27 +468,31 @@ public float4 NextFloat4()
/// <param name="min">The minimum value to generate, inclusive.</param>
/// <param name="max">The maximum value to generate, exclusive.</param>
/// <returns>A uniformly random float value in the range [min, max).</returns>
/// <remarks>The result is computed as `NextFloat() * (max - min) + min`, so floating-point rounding can in rare cases return a value equal to `max` rather than strictly less than it. Clamp the result if you require a value strictly less than `max`.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float NextFloat(float min, float max) { return NextFloat() * (max - min) + min; }

/// <summary>Returns a uniformly random float2 value with all components in the interval [min, max).</summary>
/// <param name="min">The componentwise minimum value to generate, inclusive.</param>
/// <param name="max">The componentwise maximum value to generate, exclusive.</param>
/// <returns>A uniformly random float2 value in the range [min, max).</returns>
/// <remarks>Each component is computed as `NextFloat() * (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`.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float2 NextFloat2(float2 min, float2 max) { return NextFloat2() * (max - min) + min; }

/// <summary>Returns a uniformly random float3 value with all components in the interval [min, max).</summary>
/// <param name="min">The componentwise minimum value to generate, inclusive.</param>
/// <param name="max">The componentwise maximum value to generate, exclusive.</param>
/// <returns>A uniformly random float3 value in the range [min, max).</returns>
/// <remarks>Each component is computed as `NextFloat() * (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`.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float3 NextFloat3(float3 min, float3 max) { return NextFloat3() * (max - min) + min; }

/// <summary>Returns a uniformly random float4 value with all components in the interval [min, max).</summary>
/// <param name="min">The componentwise minimum value to generate, inclusive.</param>
/// <param name="max">The componentwise maximum value to generate, exclusive.</param>
/// <returns>A uniformly random float4 value in the range [min, max).</returns>
/// <remarks>Each component is computed as `NextFloat() * (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`.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public float4 NextFloat4(float4 min, float4 max) { return NextFloat4() * (max - min) + min; }

Expand Down Expand Up @@ -572,27 +576,31 @@ public double4 NextDouble4()
/// <param name="min">The minimum value to generate, inclusive.</param>
/// <param name="max">The maximum value to generate, exclusive.</param>
/// <returns>A uniformly random double value in the range [min, max).</returns>
/// <remarks>The result is computed as `NextDouble() * (max - min) + min`, so floating-point rounding can in rare cases return a value equal to `max` rather than strictly less than it. Clamp the result if you require a value strictly less than `max`.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double NextDouble(double min, double max) { return NextDouble() * (max - min) + min; }

/// <summary>Returns a uniformly random double2 value with all components in the interval [min, max).</summary>
/// <param name="min">The componentwise minimum value to generate, inclusive.</param>
/// <param name="max">The componentwise maximum value to generate, exclusive.</param>
/// <returns>A uniformly random double2 value in the range [min, max).</returns>
/// <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`.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double2 NextDouble2(double2 min, double2 max) { return NextDouble2() * (max - min) + min; }

/// <summary>Returns a uniformly random double3 value with all components in the interval [min, max).</summary>
/// <param name="min">The componentwise minimum value to generate, inclusive.</param>
/// <param name="max">The componentwise maximum value to generate, exclusive.</param>
/// <returns>A uniformly random double3 value in the range [min, max).</returns>
/// <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`.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double3 NextDouble3(double3 min, double3 max) { return NextDouble3() * (max - min) + min; }

/// <summary>Returns a uniformly random double4 value with all components in the interval [min, max).</summary>
/// <param name="min">The componentwise minimum value to generate, inclusive.</param>
/// <param name="max">The componentwise maximum value to generate, exclusive.</param>
/// <returns>A uniformly random double4 value in the range [min, max).</returns>
/// <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`.</remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public double4 NextDouble4(double4 min, double4 max) { return NextDouble4() * (max - min) + min; }

Expand Down
3 changes: 1 addition & 2 deletions src/ValidationExceptions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"ErrorExceptions": [
],
"ErrorExceptions": [],
"WarningExceptions": []
}
4 changes: 2 additions & 2 deletions src/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "com.unity.mathematics",
"displayName": "Mathematics",
"version": "1.3.1",
"unity": "2018.3",
"version": "1.3.2",
"unity": "2021.3",
"description": "Unity's C# SIMD math library providing vector types and math functions with a shader like syntax.",
"keywords": [
"unity"
Expand Down