diff --git a/Lidgren.Network/Platform/PlatformAndroid.cs b/Lidgren.Network/Platform/PlatformAndroid.cs index 0bd8d7e..1c0f878 100644 --- a/Lidgren.Network/Platform/PlatformAndroid.cs +++ b/Lidgren.Network/Platform/PlatformAndroid.cs @@ -12,8 +12,6 @@ namespace Lidgren.Network static NetUtility() { - s_randomMacBytes = new byte[8]; - MWCRandom.Instance.NextBytes(s_randomMacBytes); } [CLSCompliant(false)] @@ -50,6 +48,11 @@ namespace Lidgren.Network public static byte[] GetMacAddressBytes() { + if (s_randomMacBytes == null) + { + s_randomMacBytes = new byte[8]; + MWCRandom.Instance.NextBytes(s_randomMacBytes); + } return s_randomMacBytes; } diff --git a/Lidgren.Network/Platform/PlatformConstrained.cs b/Lidgren.Network/Platform/PlatformConstrained.cs index 77ff6c5..7e10a6f 100644 --- a/Lidgren.Network/Platform/PlatformConstrained.cs +++ b/Lidgren.Network/Platform/PlatformConstrained.cs @@ -12,8 +12,6 @@ namespace Lidgren.Network static NetUtility() { - s_randomMacBytes = new byte[8]; - MWCRandom.Instance.NextBytes(s_randomMacBytes); } [CLSCompliant(false)] @@ -48,6 +46,11 @@ namespace Lidgren.Network public static byte[] GetMacAddressBytes() { + if (s_randomMacBytes == null) + { + s_randomMacBytes = new byte[8]; + MWCRandom.Instance.NextBytes(s_randomMacBytes); + } return s_randomMacBytes; }