com.wallstop-studios.unity-helpers 2.0.0-rc78.6 → 2.0.0-rc78.7

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.
package/README.md CHANGED
@@ -133,18 +133,18 @@ random.NextNoiseMap(width, height); // A configurable noise map generated using
133
133
 
134
134
  | Random | NextBool | Next | NextUInt | NextFloat | NextDouble | NextUint - Range | NextInt - Range |
135
135
  | ------ | -------- | ---- | -------- | --------- | ---------- | ---------------- | --------------- |
136
- | DotNetRandom | 30,700,000 | 30,900,000 | 32,600,000 | 25,700,000 | 25,800,000 |19,500,000 |18,200,000 |
137
- | LinearCongruentialGenerator | 179,600,000 | 179,700,000 | 256,600,000 | 91,400,000 | 92,000,000 |43,600,000 |39,600,000 |
138
- | PcgRandom | 168,400,000 | 168,400,000 | 234,200,000 | 88,800,000 | 89,300,000 |43,000,000 |38,700,000 |
139
- | RomuDuo | 134,600,000 | 134,700,000 | 173,800,000 | 78,200,000 | 78,800,000 |39,900,000 |36,200,000 |
140
- | SplitMix64 | 163,200,000 | 163,300,000 | 224,400,000 | 87,600,000 | 87,900,000 |42,600,000 |38,700,000 |
141
- | SquirrelRandom | 128,300,000 | 128,400,000 | 163,200,000 | 75,800,000 | 76,600,000 |39,500,000 |36,200,000 |
142
- | SystemRandom | 77,800,000 | 88,800,000 | 37,600,000 | 70,500,000 | 69,600,000 |38,200,000 |34,300,000 |
143
- | UnityRandom | 53,000,000 | 53,100,000 | 58,300,000 | 41,400,000 | 41,400,000 |26,700,000 |24,900,000 |
144
- | WyRandom | 79,100,000 | 79,100,000 | 91,100,000 | 53,000,000 | 55,300,000 |32,100,000 |30,000,000 |
145
- | XorShiftRandom | 179,500,000 | 179,500,000 | 256,500,000 | 92,000,000 | 92,400,000 |42,400,000 |38,500,000 |
146
- | XoroShiroRandom | 103,600,000 | 103,700,000 | 125,300,000 | 66,200,000 | 67,000,000 |36,900,000 |34,000,000 |
147
- | XoroShiroEnhancedRandom | 149,700,000 | 149,700,000 | 199,700,000 | 83,000,000 | 83,800,000 |41,400,000 |37,700,000 |
136
+ | DotNetRandom | 29,600,000 | 29,600,000 | 31,400,000 | 25,100,000 | 25,600,000 |19,200,000 |18,300,000 |
137
+ | LinearCongruentialGenerator | 170,500,000 | 170,600,000 | 242,100,000 | 88,600,000 | 89,100,000 |42,400,000 |39,200,000 |
138
+ | IllusionFlow | 143,600,000 | 143,400,000 | 190,600,000 | 80,600,000 | 81,100,000 |40,200,000 |37,100,000 |
139
+ | PcgRandom | 160,200,000 | 161,900,000 | 224,000,000 | 85,900,000 | 86,600,000 |41,900,000 |38,100,000 |
140
+ | RomuDuo | 128,400,000 | 128,400,000 | 166,100,000 | 76,000,000 | 76,300,000 |39,200,000 |35,600,000 |
141
+ | SplitMix64 | 156,700,000 | 157,100,000 | 214,500,000 | 84,900,000 | 84,700,000 |41,600,000 |38,200,000 |
142
+ | SquirrelRandom | 123,200,000 | 123,200,000 | 156,800,000 | 73,800,000 | 74,300,000 |38,700,000 |35,400,000 |
143
+ | SystemRandom | 74,800,000 | 85,800,000 | 36,000,000 | 67,400,000 | 67,000,000 |37,300,000 |34,200,000 |
144
+ | UnityRandom | 50,400,000 | 49,400,000 | 55,500,000 | 38,400,000 | 39,500,000 |26,400,000 |24,900,000 |
145
+ | WyRandom | 74,200,000 | 74,900,000 | 84,800,000 | 52,100,000 | 53,100,000 |32,000,000 |29,400,000 |
146
+ | XorShiftRandom | 171,800,000 | 172,200,000 | 245,700,000 | 90,000,000 | 89,900,000 |42,400,000 |38,900,000 |
147
+ | XoroShiroRandom | 98,700,000 | 98,600,000 | 118,500,000 | 64,200,000 | 64,900,000 |35,100,000 |33,200,000 |
148
148
 
149
149
  # Spatial Trees
150
150
  There are three implemented 2D immutable spatial trees that can store generic objects, as long as there is some resolution function that can convert them into Vector2 spatial positions.
@@ -10,7 +10,7 @@
10
10
 
11
11
  public enum SortAlgorithm
12
12
  {
13
- ShellEnhanced = 0,
13
+ Ghost = 0,
14
14
  Insertion = 1,
15
15
  }
16
16
 
@@ -98,15 +98,15 @@
98
98
  public static void Sort<T, TComparer>(
99
99
  this IList<T> array,
100
100
  TComparer comparer,
101
- SortAlgorithm sortAlgorithm = SortAlgorithm.ShellEnhanced
101
+ SortAlgorithm sortAlgorithm = SortAlgorithm.Ghost
102
102
  )
103
103
  where TComparer : IComparer<T>
104
104
  {
105
105
  switch (sortAlgorithm)
106
106
  {
107
- case SortAlgorithm.ShellEnhanced:
107
+ case SortAlgorithm.Ghost:
108
108
  {
109
- ShellSortEnhanced(array, comparer);
109
+ GhostSort(array, comparer);
110
110
  return;
111
111
  }
112
112
  case SortAlgorithm.Insertion:
@@ -144,11 +144,13 @@
144
144
 
145
145
  /*
146
146
  Implementation copyright Will Stafford Parsons,
147
- https://github.com/wstaffordp/bsearch-enhanced/blob/master/examples/benchmark.c#L31-L78
147
+ https://github.com/wstaffordp/ghostsort/blob/master/src/ghostsort.c
148
+
149
+ Note: Ghost Sort is currently not stable.
148
150
 
149
151
  Please contact the original author if you would like an explanation of constants.
150
152
  */
151
- public static void ShellSortEnhanced<T, TComparer>(this IList<T> array, TComparer comparer)
153
+ public static void GhostSort<T, TComparer>(this IList<T> array, TComparer comparer)
152
154
  where TComparer : IComparer<T>
153
155
  {
154
156
  int length = array.Count;
@@ -1,7 +1,7 @@
1
1
  /*
2
- XoroShiroEnhanced is a significant enhancement upon the classic XoroShiroRandom discovered by Will Stafford Parsons.
2
+ IllusionFlow is a significant enhancement upon the classic XoroShiroRandom discovered by Will Stafford Parsons.
3
3
 
4
- Reference: https://github.com/wstaffordp/bsearch-enhanced/blob/master/examples/benchmark.c#L4-L29
4
+ Reference: https://github.com/wstaffordp/illusionflow
5
5
 
6
6
  Copyright original author: https://github.com/wstaffordp
7
7
  */
@@ -14,12 +14,11 @@ namespace WallstopStudios.UnityHelpers.Core.Random
14
14
 
15
15
  [Serializable]
16
16
  [DataContract]
17
- public sealed class XoroShiroEnhancedRandom : AbstractRandom
17
+ public sealed class IllusionFlow : AbstractRandom
18
18
  {
19
19
  private const int UintByteCount = sizeof(uint) * 8;
20
20
 
21
- public static XoroShiroEnhancedRandom Instance =>
22
- ThreadLocalRandom<XoroShiroEnhancedRandom>.Instance;
21
+ public static IllusionFlow Instance => ThreadLocalRandom<IllusionFlow>.Instance;
23
22
 
24
23
  public override RandomState InternalState
25
24
  {
@@ -40,10 +39,10 @@ namespace WallstopStudios.UnityHelpers.Core.Random
40
39
  private uint _d;
41
40
  private uint _e;
42
41
 
43
- public XoroShiroEnhancedRandom()
42
+ public IllusionFlow()
44
43
  : this(Guid.NewGuid()) { }
45
44
 
46
- public XoroShiroEnhancedRandom(Guid guid, uint? extraSeed = null)
45
+ public IllusionFlow(Guid guid, uint? extraSeed = null)
47
46
  {
48
47
  byte[] guidArray = guid.ToByteArray();
49
48
  _a = BitConverter.ToUInt32(guidArray, 0);
@@ -54,7 +53,7 @@ namespace WallstopStudios.UnityHelpers.Core.Random
54
53
  }
55
54
 
56
55
  [JsonConstructor]
57
- public XoroShiroEnhancedRandom(RandomState internalState)
56
+ public IllusionFlow(RandomState internalState)
58
57
  {
59
58
  unchecked
60
59
  {
@@ -72,7 +71,7 @@ namespace WallstopStudios.UnityHelpers.Core.Random
72
71
  else
73
72
  {
74
73
  throw new InvalidOperationException(
75
- $"{nameof(XoroShiroEnhancedRandom)} requires a Gaussian state."
74
+ $"{nameof(IllusionFlow)} requires a Gaussian state."
76
75
  );
77
76
  }
78
77
  }
@@ -102,7 +101,7 @@ namespace WallstopStudios.UnityHelpers.Core.Random
102
101
 
103
102
  public override IRandom Copy()
104
103
  {
105
- return new XoroShiroEnhancedRandom(InternalState);
104
+ return new IllusionFlow(InternalState);
106
105
  }
107
106
  }
108
107
  }
@@ -2,6 +2,6 @@
2
2
  {
3
3
  public static class PRNG
4
4
  {
5
- public static IRandom Instance => XoroShiroEnhancedRandom.Instance;
5
+ public static IRandom Instance => IllusionFlow.Instance;
6
6
  }
7
7
  }
@@ -114,7 +114,7 @@
114
114
  Array.Sort(conventionalSorted);
115
115
 
116
116
  int[] insertionSorted = input.ToArray();
117
- insertionSorted.ShellSortEnhanced(new IntComparer());
117
+ insertionSorted.GhostSort(new IntComparer());
118
118
  Assert.That(conventionalSorted, Is.EqualTo(insertionSorted));
119
119
  Assert.That(input.OrderBy(x => x), Is.EqualTo(insertionSorted));
120
120
  }
@@ -39,11 +39,7 @@
39
39
  input => input.InsertionSort(IntComparer.Instance),
40
40
  timeout
41
41
  );
42
- int shellSort = RunTest(
43
- list,
44
- input => input.ShellSortEnhanced(IntComparer.Instance),
45
- timeout
46
- );
42
+ int shellSort = RunTest(list, input => input.GhostSort(IntComparer.Instance), timeout);
47
43
 
48
44
  UnityEngine.Debug.Log("| Operation | Operations / Second |");
49
45
  UnityEngine.Debug.Log($"| Reference | {reference / timeout.TotalSeconds:N0} |");
@@ -23,6 +23,7 @@
23
23
 
24
24
  RunTest(new DotNetRandom(), timeout);
25
25
  RunTest(new LinearCongruentialGenerator(), timeout);
26
+ RunTest(new IllusionFlow(), timeout);
26
27
  RunTest(new PcgRandom(), timeout);
27
28
  RunTest(new RomuDuo(), timeout);
28
29
  RunTest(new SplitMix64(), timeout);
@@ -32,7 +33,6 @@
32
33
  RunTest(new WyRandom(), timeout);
33
34
  RunTest(new XorShiftRandom(), timeout);
34
35
  RunTest(new XoroShiroRandom(), timeout);
35
- RunTest(new XoroShiroEnhancedRandom(), timeout);
36
36
  }
37
37
 
38
38
  private static void RunTest<T>(T random, TimeSpan timeout)
@@ -2,11 +2,11 @@
2
2
  {
3
3
  using WallstopStudios.UnityHelpers.Core.Random;
4
4
 
5
- public sealed class XoroShiroEnhancedRandomTests : RandomTestBase
5
+ public sealed class IllusionFlowTests : RandomTestBase
6
6
  {
7
7
  protected override IRandom NewRandom()
8
8
  {
9
- return new XoroShiroEnhancedRandom();
9
+ return new IllusionFlow();
10
10
  }
11
11
  }
12
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.wallstop-studios.unity-helpers",
3
- "version": "2.0.0-rc78.6",
3
+ "version": "2.0.0-rc78.7",
4
4
  "displayName": "Unity Helpers",
5
5
  "description": "Various Unity Helper Library",
6
6
  "dependencies": {},
@@ -40,3 +40,4 @@
40
40
 
41
41
 
42
42
 
43
+