com.wallstop-studios.unity-helpers 2.0.0-rc05 → 2.0.0-rc06

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/Runtime/Core/DataStructure/TimedCache.cs +4 -3
  2. package/Runtime/Core/Extension/IListExtensions.cs +2 -2
  3. package/Runtime/Core/Extension/RandomExtensions.cs +23 -4
  4. package/Runtime/Core/Extension/UnityExtensions.cs +278 -90
  5. package/Runtime/Core/Helper/ArrayConverter.cs +39 -0
  6. package/Runtime/Core/Helper/ArrayConverter.cs.meta +3 -0
  7. package/Runtime/Core/Helper/Helpers.cs +209 -84
  8. package/Runtime/Core/Helper/WallMath.cs +85 -22
  9. package/Runtime/Core/Random/AbstractRandom.cs +34 -20
  10. package/Runtime/Core/Random/DotNetRandom.cs +3 -5
  11. package/Runtime/Core/Random/PRNG.cs +7 -0
  12. package/Runtime/Core/Random/PRNG.cs.meta +3 -0
  13. package/Runtime/Core/Random/PcgRandom.cs +4 -6
  14. package/Runtime/Core/Random/RandomState.cs +31 -3
  15. package/Runtime/Core/Random/SquirrelRandom.cs +3 -5
  16. package/Runtime/Core/Random/SystemRandom.cs +20 -11
  17. package/Runtime/Core/Random/ThreadLocalRandom.cs +2 -1
  18. package/Runtime/Core/Random/UnityRandom.cs +2 -4
  19. package/Runtime/Core/Random/WyRandom.cs +2 -4
  20. package/Runtime/Core/Random/XorShiftRandom.cs +3 -5
  21. package/Runtime/Core/Serialization/Serializer.cs +36 -14
  22. package/Runtime/Utils/CircleLineRenderer.cs +17 -5
  23. package/Tests/Runtime/DataStructures/SpatialTreeTests.cs +34 -10
  24. package/Tests/Runtime/Helper/ArrayConverterTests.cs +19 -0
  25. package/Tests/Runtime/Helper/ArrayConverterTests.cs.meta +3 -0
  26. package/Tests/Runtime/Helper/WallMathTests.cs +221 -0
  27. package/Tests/Runtime/Helper/WallMathTests.cs.meta +3 -0
  28. package/Tests/Runtime/Helper.meta +3 -0
  29. package/Tests/Runtime/Performance/SpatialTreePerformanceTest.cs +47 -34
  30. package/Tests/Runtime/Random/RandomTestBase.cs +23 -3
  31. package/Tests/Runtime/Serialization/JsonSerializationTest.cs +24 -11
  32. package/Tests/Runtime/Utils/SpriteRendererMetadataTests.cs +21 -17
  33. package/package.json +1 -1
@@ -14,7 +14,9 @@
14
14
 
15
15
  public static double BoundedDouble(double max, double value)
16
16
  {
17
- return value < max ? value : BitConverter.Int64BitsToDouble(BitConverter.DoubleToInt64Bits(value) - 1);
17
+ return value < max
18
+ ? value
19
+ : BitConverter.Int64BitsToDouble(BitConverter.DoubleToInt64Bits(value) - 1);
18
20
  }
19
21
 
20
22
  public static float BoundedFloat(float max, float value)
@@ -22,52 +24,113 @@
22
24
  return value < max
23
25
  ? value
24
26
  : BitConverter.ToSingle(
25
- BitConverter.GetBytes(BitConverter.ToInt32(BitConverter.GetBytes(value), 0) - 1), 0);
27
+ BitConverter.GetBytes(
28
+ BitConverter.ToInt32(BitConverter.GetBytes(value), 0) - 1
29
+ ),
30
+ 0
31
+ );
26
32
  }
27
33
 
28
- public static int WrappedAdd(int value, int increment, int max)
34
+ public static int WrappedAdd(this int value, int increment, int max)
29
35
  {
30
36
  WrappedAdd(ref value, increment, max);
31
37
  return value;
32
38
  }
33
39
 
34
- public static void WrappedAdd(ref int value, int increment, int max)
40
+ public static int WrappedAdd(ref int value, int increment, int max)
35
41
  {
36
- value = value + increment;
42
+ value += increment;
37
43
  if (value < max)
38
44
  {
39
- return;
45
+ return value;
40
46
  }
41
- value %= max;
47
+ return value %= max;
42
48
  }
43
49
 
44
- public static int WrappedIncrement(int value, int max)
50
+ public static int WrappedIncrement(this int value, int max)
45
51
  {
46
52
  return WrappedAdd(value, 1, max);
47
53
  }
48
54
 
49
- public static void WrappedIncrement(ref int value, int max)
55
+ public static int WrappedIncrement(ref int value, int max)
56
+ {
57
+ return WrappedAdd(ref value, 1, max);
58
+ }
59
+
60
+ public static T Clamp<T>(this T value, T min, T max)
61
+ where T : IComparable<T>
62
+ {
63
+ if (value.CompareTo(min) < 0)
64
+ {
65
+ return min;
66
+ }
67
+
68
+ return max.CompareTo(value) < 0 ? max : value;
69
+ }
70
+
71
+ public static Vector2 Clamp(this Rect bounds, Vector2 point)
50
72
  {
51
- WrappedAdd(ref value, 1, max);
73
+ return Clamp(bounds, ref point);
52
74
  }
53
75
 
54
- public static void Clamp(this Rect bounds, ref Vector2 point)
76
+ public static Vector2 Clamp(this Rect bounds, ref Vector2 point)
55
77
  {
56
- if (!bounds.Contains(point))
78
+ if (bounds.Contains(point))
79
+ {
80
+ return point;
81
+ }
82
+
83
+ Vector2 center = bounds.center;
84
+ Vector2 direction = point - center;
85
+
86
+ if (direction == Vector2.zero)
87
+ {
88
+ return center;
89
+ }
90
+
91
+ float tMax = float.MaxValue;
92
+ Vector2 min = bounds.min;
93
+ Vector2 max = bounds.max;
94
+
95
+ if (direction.x != 0)
96
+ {
97
+ if (0 < direction.x)
98
+ {
99
+ float t2 = (max.x - center.x) / direction.x;
100
+ tMax = Math.Min(tMax, t2);
101
+ }
102
+ else
103
+ {
104
+ float t1 = (min.x - center.x) / direction.x;
105
+ tMax = Math.Min(tMax, t1);
106
+ }
107
+ }
108
+
109
+ if (direction.y != 0)
57
110
  {
58
- Vector2 xClamp = bounds.width < 0 ?
59
- new Vector2(bounds.x + bounds.width, bounds.x) :
60
- new Vector2(bounds.x, bounds.x + bounds.width);
61
- Vector2 yClamp = bounds.height < 0 ?
62
- new Vector2(bounds.y + bounds.height, bounds.y) :
63
- new Vector2(bounds.y, bounds.y + bounds.height);
64
-
65
- point.x = Mathf.Clamp(point.x, xClamp.x, xClamp.y);
66
- point.y = Mathf.Clamp(point.y, yClamp.x, yClamp.y);
111
+ if (direction.y > 0)
112
+ {
113
+ float t2 = (max.y - center.y) / direction.y;
114
+ tMax = Math.Min(tMax, t2);
115
+ }
116
+ else
117
+ {
118
+ float t1 = (min.y - center.y) / direction.y;
119
+ tMax = Math.Min(tMax, t1);
120
+ }
67
121
  }
122
+
123
+ tMax = Mathf.Clamp01(tMax);
124
+
125
+ point = center + direction * tMax;
126
+ point = new Vector2(
127
+ Mathf.Clamp(point.x, min.x, max.x),
128
+ Mathf.Clamp(point.y, min.y, max.y)
129
+ );
130
+ return point;
68
131
  }
69
132
 
70
- public static bool Approximately(float lhs, float rhs, float tolerance = 0.045f)
133
+ public static bool Approximately(this float lhs, float rhs, float tolerance = 0.045f)
71
134
  {
72
135
  return Math.Abs(lhs - rhs) <= tolerance;
73
136
  }
@@ -5,6 +5,7 @@
5
5
  using System.Collections.Generic;
6
6
  using System.Linq;
7
7
  using System.Runtime.Serialization;
8
+ using System.Text.Json.Serialization;
8
9
  using DataStructure.Adapters;
9
10
  using UnityEngine;
10
11
 
@@ -30,8 +31,7 @@
30
31
  do
31
32
  {
32
33
  result = unchecked((int)NextUint());
33
- }
34
- while (result < 0);
34
+ } while (result < 0);
35
35
 
36
36
  return result;
37
37
  }
@@ -50,7 +50,9 @@
50
50
  {
51
51
  if (max <= min)
52
52
  {
53
- throw new ArgumentException($"Min {min} cannot be larger-than or equal-to max {max}");
53
+ throw new ArgumentException(
54
+ $"Min {min} cannot be larger-than or equal-to max {max}"
55
+ );
54
56
  }
55
57
 
56
58
  uint range = unchecked((uint)(max - min));
@@ -83,7 +85,9 @@
83
85
  {
84
86
  if (max <= min)
85
87
  {
86
- throw new ArgumentException($"Min {min} cannot be larger-than or equal-to max {max}");
88
+ throw new ArgumentException(
89
+ $"Min {min} cannot be larger-than or equal-to max {max}"
90
+ );
87
91
  }
88
92
 
89
93
  return min + NextUint(max - min);
@@ -147,8 +151,7 @@
147
151
  do
148
152
  {
149
153
  withinRange = NextLong();
150
- }
151
- while (withinRange < 0 || max <= withinRange);
154
+ } while (withinRange < 0 || max <= withinRange);
152
155
  return withinRange;
153
156
  }
154
157
 
@@ -156,7 +159,9 @@
156
159
  {
157
160
  if (max <= min)
158
161
  {
159
- throw new ArgumentException($"Min {min} cannot be larger-than or equal-to Max {max}");
162
+ throw new ArgumentException(
163
+ $"Min {min} cannot be larger-than or equal-to Max {max}"
164
+ );
160
165
  }
161
166
 
162
167
  return min + NextLong(max - min);
@@ -176,7 +181,9 @@
176
181
  {
177
182
  if (max <= min)
178
183
  {
179
- throw new ArgumentException($"Min {min} cannot be larger-than or equal-to max {max}");
184
+ throw new ArgumentException(
185
+ $"Min {min} cannot be larger-than or equal-to max {max}"
186
+ );
180
187
  }
181
188
 
182
189
  return unchecked((ulong)NextLong(unchecked((long)min), unchecked((long)max)));
@@ -227,8 +234,7 @@
227
234
  do
228
235
  {
229
236
  value = NextUint() * MagicDouble;
230
- }
231
- while (value < 0 || 1 <= value);
237
+ } while (value < 0 || 1 <= value);
232
238
 
233
239
  return value;
234
240
  }
@@ -247,7 +253,9 @@
247
253
  {
248
254
  if (max <= min)
249
255
  {
250
- throw new ArgumentException($"Min {min} cannot be larger-than or equal-to max {max}");
256
+ throw new ArgumentException(
257
+ $"Min {min} cannot be larger-than or equal-to max {max}"
258
+ );
251
259
  }
252
260
 
253
261
  double range = max - min;
@@ -277,8 +285,7 @@
277
285
  x = 2 * NextDouble() - 1;
278
286
  y = 2 * NextDouble() - 1;
279
287
  square = x * x + y * y;
280
- }
281
- while (square > 1 || square == 0);
288
+ } while (square > 1 || square == 0);
282
289
 
283
290
  double fac = Math.Sqrt(-2 * Math.Log(square) / square);
284
291
  _cachedGaussian = x * fac;
@@ -292,8 +299,7 @@
292
299
  {
293
300
  uint floatAsInt = NextUint();
294
301
  value = (floatAsInt >> 8) * MagicFloat;
295
- }
296
- while (value < 0 || 1 <= value);
302
+ } while (value < 0 || 1 <= value);
297
303
 
298
304
  return value;
299
305
  }
@@ -312,7 +318,9 @@
312
318
  {
313
319
  if (max <= min)
314
320
  {
315
- throw new ArgumentException($"Min {min} cannot be larger-than or equal-to max {max}");
321
+ throw new ArgumentException(
322
+ $"Min {min} cannot be larger-than or equal-to max {max}"
323
+ );
316
324
  }
317
325
 
318
326
  return min + NextFloat(max - min);
@@ -397,7 +405,8 @@
397
405
  }
398
406
  }
399
407
 
400
- public T Next<T>() where T : struct, Enum
408
+ public T Next<T>()
409
+ where T : struct, Enum
401
410
  {
402
411
  Type enumType = typeof(T);
403
412
  T[] enumValues;
@@ -413,7 +422,8 @@
413
422
  return RandomOf(enumValues);
414
423
  }
415
424
 
416
- public T NextCachedEnum<T>() where T : struct, Enum
425
+ public T NextCachedEnum<T>()
426
+ where T : struct, Enum
417
427
  {
418
428
  Type enumType = typeof(T);
419
429
  T[] enumValues = (T[])EnumTypeCache.GetOrAdd(enumType, Enum.GetValues);
@@ -511,7 +521,11 @@
511
521
  {
512
522
  // Returns a value between 0f and 1f based on noiseMap value
513
523
  // minNoiseHeight being 0f, and maxNoiseHeight being 1f
514
- noiseMap[x, y] = Mathf.InverseLerp(minNoiseHeight, maxNoiseHeight, noiseMap[x, y]);
524
+ noiseMap[x, y] = Mathf.InverseLerp(
525
+ minNoiseHeight,
526
+ maxNoiseHeight,
527
+ noiseMap[x, y]
528
+ );
515
529
  }
516
530
  }
517
531
  return noiseMap;
@@ -534,4 +548,4 @@
534
548
 
535
549
  public abstract IRandom Copy();
536
550
  }
537
- }
551
+ }
@@ -8,8 +8,6 @@
8
8
  [DataContract]
9
9
  public sealed class DotNetRandom : AbstractRandom
10
10
  {
11
- [JsonPropertyName("State")]
12
- [DataMember(Name = "State")]
13
11
  public override RandomState InternalState =>
14
12
  new RandomState(unchecked((ulong)_seed), state2: _numberGenerated);
15
13
 
@@ -27,12 +25,12 @@
27
25
  }
28
26
 
29
27
  [JsonConstructor]
30
- public DotNetRandom(RandomState state)
28
+ public DotNetRandom(RandomState internalState)
31
29
  {
32
- _seed = unchecked((int)state.State1);
30
+ _seed = unchecked((int)internalState.State1);
33
31
  _random = new Random(_seed);
34
32
  _numberGenerated = 0;
35
- ulong generationCount = state.State2;
33
+ ulong generationCount = internalState.State2;
36
34
 
37
35
  while (_numberGenerated < generationCount)
38
36
  {
@@ -0,0 +1,7 @@
1
+ namespace UnityHelpers.Core.Random
2
+ {
3
+ public static class PRNG
4
+ {
5
+ public static IRandom Instance => PcgRandom.Instance;
6
+ }
7
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: 5041bafe46dc450bb37153e394011636
3
+ timeCreated: 1732564259
@@ -15,8 +15,6 @@
15
15
  IComparable,
16
16
  IComparable<PcgRandom>
17
17
  {
18
- [DataMember(Name = "State")]
19
- [JsonPropertyName("State")]
20
18
  public static IRandom Instance => ThreadLocalRandom<PcgRandom>.Instance;
21
19
 
22
20
  internal readonly ulong _increment;
@@ -34,11 +32,11 @@
34
32
  }
35
33
 
36
34
  [JsonConstructor]
37
- public PcgRandom(RandomState state)
35
+ public PcgRandom(RandomState internalState)
38
36
  {
39
- _state = state.State1;
40
- _increment = state.State2;
41
- _cachedGaussian = state.Gaussian;
37
+ _state = internalState.State1;
38
+ _increment = internalState.State2;
39
+ _cachedGaussian = internalState.Gaussian;
42
40
  }
43
41
 
44
42
  public PcgRandom(ulong increment, ulong state)
@@ -1,16 +1,20 @@
1
1
  namespace UnityHelpers.Core.Random
2
2
  {
3
3
  using System;
4
+ using System.Linq;
5
+ using System.Runtime.Serialization;
4
6
  using System.Text.Json.Serialization;
5
7
  using Extension;
6
8
  using Helper;
7
9
  using ProtoBuf;
8
10
 
9
11
  [Serializable]
12
+ [DataContract]
10
13
  [ProtoContract]
11
14
  public struct RandomState : IEquatable<RandomState>
12
15
  {
13
16
  public ulong State1 => _state1;
17
+
14
18
  public ulong State2 => _state2;
15
19
 
16
20
  public double? Gaussian
@@ -26,6 +30,8 @@
26
30
  }
27
31
  }
28
32
 
33
+ public byte[] Payload => _payload;
34
+
29
35
  [ProtoMember(1)]
30
36
  private ulong _state1;
31
37
 
@@ -38,16 +44,31 @@
38
44
  [ProtoMember(4)]
39
45
  private double _gaussian;
40
46
 
47
+ [ProtoMember(5)]
48
+ private byte[] _payload;
49
+
41
50
  private int _hashCode;
42
51
 
43
52
  [JsonConstructor]
44
- public RandomState(ulong state1, ulong state2 = 0, double? gaussian = null)
53
+ public RandomState(
54
+ ulong state1,
55
+ ulong state2 = 0,
56
+ double? gaussian = null,
57
+ byte[] payload = null
58
+ )
45
59
  {
46
60
  _state1 = state1;
47
61
  _state2 = state2;
48
62
  _hasGaussian = gaussian.HasValue;
49
63
  _gaussian = gaussian ?? 0;
50
- _hashCode = Objects.ValueTypeHashCode(state1, state2, _hasGaussian, _gaussian);
64
+ _payload = payload?.ToArray();
65
+ _hashCode = Objects.ValueTypeHashCode(
66
+ state1,
67
+ state2,
68
+ _hasGaussian,
69
+ _gaussian,
70
+ _payload != null
71
+ );
51
72
  }
52
73
 
53
74
  public RandomState(Guid guid)
@@ -57,7 +78,14 @@
57
78
  _state2 = BitConverter.ToUInt64(guidBytes, sizeof(ulong));
58
79
  _hasGaussian = false;
59
80
  _gaussian = 0;
60
- _hashCode = Objects.ValueTypeHashCode(_state1, _state2, _hasGaussian, _gaussian);
81
+ _payload = null;
82
+ _hashCode = Objects.ValueTypeHashCode(
83
+ _state1,
84
+ _state2,
85
+ _hasGaussian,
86
+ _gaussian,
87
+ _payload != null
88
+ );
61
89
  }
62
90
 
63
91
  [ProtoAfterDeserialization]
@@ -16,8 +16,6 @@
16
16
 
17
17
  public static readonly SquirrelRandom Instance = ThreadLocalRandom<SquirrelRandom>.Instance;
18
18
 
19
- [JsonPropertyName("State")]
20
- [DataMember(Name = "State")]
21
19
  public override RandomState InternalState => new(_position, gaussian: _cachedGaussian);
22
20
 
23
21
  private uint _position;
@@ -31,10 +29,10 @@
31
29
  }
32
30
 
33
31
  [JsonConstructor]
34
- public SquirrelRandom(RandomState randomState)
32
+ public SquirrelRandom(RandomState internalState)
35
33
  {
36
- _position = unchecked((uint)randomState.State1);
37
- _cachedGaussian = randomState.Gaussian;
34
+ _position = unchecked((uint)internalState.State1);
35
+ _cachedGaussian = internalState.Gaussian;
38
36
  }
39
37
 
40
38
  public override uint NextUint()
@@ -3,6 +3,7 @@
3
3
  using System;
4
4
  using System.Runtime.Serialization;
5
5
  using System.Text.Json.Serialization;
6
+ using Helper;
6
7
 
7
8
  /// <summary>
8
9
  /// Implementation dependent upon .Net's Random class.
@@ -11,23 +12,27 @@
11
12
  [DataContract]
12
13
  public sealed class SystemRandom : AbstractRandom
13
14
  {
14
- [JsonPropertyName("State")]
15
- [DataMember(Name = "State")]
15
+ public static IRandom Instance => ThreadLocalRandom<SystemRandom>.Instance;
16
+
16
17
  public override RandomState InternalState =>
17
- new(unchecked((ulong)inext), unchecked((ulong)inextp), _cachedGaussian);
18
+ new(
19
+ unchecked((ulong)inext),
20
+ unchecked((ulong)inextp),
21
+ _cachedGaussian,
22
+ ArrayConverter.IntArrayToByteArrayBlockCopy(SeedArray)
23
+ );
18
24
 
19
25
  /*
20
26
  Copied from Random.cs source. Apparently it isn't guaranteed to be the
21
- same across platforms and we depend on that.
27
+ same across platforms, a fact which defeats the purpose of these serializable
28
+ randoms.
22
29
  */
23
30
  private int inext;
24
31
  private int inextp;
25
32
  private readonly int[] SeedArray = new int[56];
26
33
 
27
- public static IRandom Instance => ThreadLocalRandom<SystemRandom>.Instance;
28
-
29
34
  public SystemRandom()
30
- : this(Environment.TickCount) { }
35
+ : this(Guid.NewGuid().GetHashCode()) { }
31
36
 
32
37
  public SystemRandom(int seed)
33
38
  {
@@ -57,11 +62,15 @@
57
62
  }
58
63
 
59
64
  [JsonConstructor]
60
- public SystemRandom(RandomState randomState)
65
+ public SystemRandom(RandomState internalState)
61
66
  {
62
- inext = unchecked((int)randomState.State1);
63
- inextp = unchecked((int)randomState.State2);
64
- _cachedGaussian = randomState.Gaussian;
67
+ unchecked
68
+ {
69
+ inext = (int)internalState.State1;
70
+ inextp = (int)internalState.State2;
71
+ }
72
+ _cachedGaussian = internalState.Gaussian;
73
+ SeedArray = ArrayConverter.ByteArrayToIntArrayBlockCopy(internalState.Payload);
65
74
  }
66
75
 
67
76
  public override uint NextUint()
@@ -2,7 +2,8 @@
2
2
  {
3
3
  using System.Threading;
4
4
 
5
- public static class ThreadLocalRandom<T> where T : IRandom, new()
5
+ public static class ThreadLocalRandom<T>
6
+ where T : IRandom, new()
6
7
  {
7
8
  private static readonly ThreadLocal<T> RandomCache = new ThreadLocal<T>(() => new T());
8
9
 
@@ -10,8 +10,6 @@
10
10
  {
11
11
  public static readonly UnityRandom Instance = new();
12
12
 
13
- [JsonPropertyName("State")]
14
- [DataMember(Name = "State")]
15
13
  public override RandomState InternalState
16
14
  {
17
15
  get
@@ -38,11 +36,11 @@
38
36
  }
39
37
 
40
38
  [JsonConstructor]
41
- public UnityRandom(RandomState state)
39
+ public UnityRandom(RandomState internalState)
42
40
  {
43
41
  unchecked
44
42
  {
45
- _seed = state.Gaussian != null ? (int)state.State1 : null;
43
+ _seed = internalState.Gaussian != null ? (int)internalState.State1 : null;
46
44
  }
47
45
  }
48
46
 
@@ -16,8 +16,6 @@
16
16
 
17
17
  public static IRandom Instance => ThreadLocalRandom<WyRandom>.Instance;
18
18
 
19
- [JsonPropertyName("State")]
20
- [DataMember(Name = "State")]
21
19
  public override RandomState InternalState => new RandomState(_state);
22
20
 
23
21
  private ulong _state;
@@ -32,9 +30,9 @@
32
30
  }
33
31
 
34
32
  [JsonConstructor]
35
- public WyRandom(RandomState randomState)
33
+ public WyRandom(RandomState internalState)
36
34
  {
37
- _state = randomState.State1;
35
+ _state = internalState.State1;
38
36
  }
39
37
 
40
38
  public WyRandom(ulong state)
@@ -10,8 +10,6 @@
10
10
  {
11
11
  public static IRandom Instance => ThreadLocalRandom<XorShiftRandom>.Instance;
12
12
 
13
- [JsonPropertyName("State")]
14
- [DataMember(Name = "State")]
15
13
  public override RandomState InternalState => new(_state, 0, _cachedGaussian);
16
14
 
17
15
  private uint _state;
@@ -25,10 +23,10 @@
25
23
  }
26
24
 
27
25
  [JsonConstructor]
28
- public XorShiftRandom(RandomState state)
26
+ public XorShiftRandom(RandomState internalState)
29
27
  {
30
- _state = unchecked((uint)state.State1);
31
- _cachedGaussian = state.Gaussian;
28
+ _state = unchecked((uint)internalState.State1);
29
+ _cachedGaussian = internalState.Gaussian;
32
30
  }
33
31
 
34
32
  public override uint NextUint()