diff --git a/ICD.Common.Utils/GuidUtils.cs b/ICD.Common.Utils/GuidUtils.cs index d68feb6..045c9fa 100644 --- a/ICD.Common.Utils/GuidUtils.cs +++ b/ICD.Common.Utils/GuidUtils.cs @@ -4,6 +4,9 @@ namespace ICD.Common.Utils { public static class GuidUtils { + /// + /// Generates a pseudo-random guid from the given seed. + /// public static Guid GenerateSeeded(int seed) { Random seeded = new Random(seed); @@ -13,5 +16,19 @@ namespace ICD.Common.Utils return new Guid(bytes); } + + /// + /// Combines the two guids to make a new, deterministic guid. + /// + public static Guid Combine(Guid a, Guid b) + { + byte[] aBytes = a.ToByteArray(); + byte[] bBytes = b.ToByteArray(); + + for (int index = 0; index < aBytes.Length; index++) + aBytes[index] = (byte)(aBytes[index] ^ bBytes[index]); + + return new Guid(aBytes); + } } }