Skip to content

Commit 7810cf4

Browse files
committed
first push
1 parent 4fde35a commit 7810cf4

2 files changed

Lines changed: 117 additions & 0 deletions

File tree

.gitignore

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,3 +348,71 @@ MigrationBackup/
348348

349349
# Ionide (cross platform F# VS Code tools) working folder
350350
.ionide/
351+
352+
/[Ll]ibrary/
353+
/[Tt]emp/
354+
/[Oo]bj/
355+
/[Bb]uild/
356+
/[Bb]uilds/
357+
/[Ll]ogs/
358+
/[Uu]ser[Ss]ettings/
359+
360+
# MemoryCaptures can get excessive in size.
361+
# They also could contain extremely sensitive data
362+
/[Mm]emoryCaptures/
363+
364+
# Asset meta data should only be ignored when the corresponding asset is also ignored
365+
!/[Aa]ssets/**/*.meta
366+
367+
# Uncomment this line if you wish to ignore the asset store tools plugin
368+
# /[Aa]ssets/AssetStoreTools*
369+
370+
# Autogenerated Jetbrains Rider plugin
371+
/[Aa]ssets/Plugins/Editor/JetBrains*
372+
373+
# Visual Studio cache directory
374+
.vs/
375+
376+
# Gradle cache directory
377+
.gradle/
378+
379+
# Autogenerated VS/MD/Consulo solution and project files
380+
ExportedObj/
381+
.consulo/
382+
*.csproj
383+
*.unityproj
384+
*.sln
385+
*.suo
386+
*.tmp
387+
*.user
388+
*.userprefs
389+
*.pidb
390+
*.booproj
391+
*.svd
392+
*.pdb
393+
*.mdb
394+
*.opendb
395+
*.VC.db
396+
397+
# Unity3D generated meta files
398+
*.pidb.meta
399+
*.pdb.meta
400+
*.mdb.meta
401+
402+
# Unity3D generated file on crash reports
403+
sysinfo.txt
404+
405+
# Builds
406+
*.apk
407+
*.aab
408+
*.unitypackage
409+
410+
# Crashlytics generated file
411+
crashlytics-build.properties
412+
413+
# Packed Addressables
414+
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*
415+
416+
# Temporary auto-generated Android Assets
417+
/[Aa]ssets/[Ss]treamingAssets/aa.meta
418+
/[Aa]ssets/[Ss]treamingAssets/aa/*

ExtensionMethods.cs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
namespace YoukaiFox.SystemExtensions
2+
{
3+
public static class ExtensionMethods
4+
{
5+
/// <summary>
6+
/// Shuffles the array using the Fisher-Yates method.
7+
/// </summary>
8+
/// <param name="items"></param>
9+
/// <typeparam name="T"></typeparam>
10+
public static void Shuffle<T>(this T[] items)
11+
{
12+
System.Random rng = new System.Random();
13+
int n = items.Length;
14+
15+
for (int i = 0; i < n; i++)
16+
{
17+
int randomInt = rng.Next(0, i);
18+
Swap(items[i], items[randomInt]);
19+
}
20+
}
21+
22+
/// <summary>
23+
/// Get the first valid index in the collection.
24+
/// </summary>
25+
/// <param name="items"></param>
26+
/// <typeparam name="T"></typeparam>
27+
/// <returns></returns>
28+
public static int FirstValidIndex<T>(this T[] items)
29+
{
30+
if (items.Length > 0)
31+
return 0;
32+
33+
return -1;
34+
}
35+
36+
/// <summary>
37+
/// Swap the two values provided between themselves.
38+
/// </summary>
39+
/// <param name="v1"></param>
40+
/// <param name="v2"></param>
41+
/// <typeparam name="T"></typeparam>
42+
public static void Swap<T>(T v1, T v2)
43+
{
44+
T temp = v1;
45+
v1 = v2;
46+
v2 = temp;
47+
}
48+
}
49+
}

0 commit comments

Comments
 (0)