Skip to content

Commit 29d2b23

Browse files
committed
Adding utils for getting unique hex
1 parent c2d6031 commit 29d2b23

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Core/Scripts/Util/Utils.cs

+11
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,17 @@ public static Color RandomColor()
417417
);
418418
}
419419

420+
public static string GetUniqueHexNumber(ISet<string> taken, int digits)
421+
{
422+
string candidate;
423+
do
424+
{
425+
candidate = GetRandomHexNumber(digits);
426+
} while (taken.Contains(candidate));
427+
428+
return candidate;
429+
}
430+
420431
public static string GetRandomHexNumber(int digits)
421432
{
422433
var buffer = new byte[digits / 2];

0 commit comments

Comments
 (0)