Dev changes (#3)

* Fixed dependency

* Updates to NeoDictionary

* Changes to NeoDictionary

* Started working on a Git implementation to integrate into Game Engines in the future

* Added commit functionality to the git library

* New changes

* Added select for NeoDictionary.cs

* Fixed issue with previous new method

* Added a Benchmarking Tool to be used mostly in game engines

* Added IndexOf to NeoDictionary.cs

* Added new method for BenchmarkUtility.cs

* added an instacedobject class

* Added a new shuffle method for lists

* fixed return type

* Added new Changelog generator
This commit was merged in pull request #3.
This commit is contained in:
2025-02-18 21:09:25 +00:00
committed by GitHub
parent 8f249d2567
commit 7b6115da21
22 changed files with 759 additions and 3 deletions
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
namespace GameDevLibrary.Extensions
{
@@ -98,7 +99,7 @@ namespace GameDevLibrary.Extensions
return values;
}
public static IEnumerable<TSource> DistinctBy<TSource, TKey>
/*public static IEnumerable<TSource> DistinctBy<TSource, TKey>
(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
{
HashSet<TKey> seenKeys = new HashSet<TKey>();
@@ -109,7 +110,7 @@ namespace GameDevLibrary.Extensions
yield return element;
}
}
}
}*/
// Idea obtained from TaroDev's video on things to do in Unity - https://youtu.be/Ic5ux-tpkCE?t=302
@@ -117,5 +118,30 @@ namespace GameDevLibrary.Extensions
{
return array[currentIndex++ % array.Count];
}
/// <summary>
/// Shuffle around items in a list.
/// Code obtained from https://stackoverflow.com/a/1262619
/// </summary>
/// <param name="list"></param>
/// <typeparam name="T"></typeparam>
public static IList<T> Shuffle<T>(this IList<T> list)
{
RNGCryptoServiceProvider provider = new RNGCryptoServiceProvider();
int n = list.Count;
while (n > 1)
{
byte[] box = new byte[1];
do provider.GetBytes(box);
while (!(box[0] < n * (Byte.MaxValue / n)));
int k = (box[0] % n);
n--;
(list[k], list[n]) = (list[n], list[k]);
}
return list;
}
}
}