From f2663587c40d5b58f5148a45904449111498673a Mon Sep 17 00:00:00 2001 From: Mike Parker Date: Wed, 23 Dec 2020 19:59:55 +0000 Subject: [PATCH 1/2] Use a random seed for ParticleEmitters --- src/dotnet/MonoGame.Extended.Particles/ParticleEmitter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dotnet/MonoGame.Extended.Particles/ParticleEmitter.cs b/src/dotnet/MonoGame.Extended.Particles/ParticleEmitter.cs index 0d7c02dc..13b22b44 100644 --- a/src/dotnet/MonoGame.Extended.Particles/ParticleEmitter.cs +++ b/src/dotnet/MonoGame.Extended.Particles/ParticleEmitter.cs @@ -11,7 +11,7 @@ namespace MonoGame.Extended.Particles { public unsafe class ParticleEmitter : IDisposable { - private readonly FastRandom _random = new FastRandom(); + private readonly FastRandom _random = new FastRandom(Guid.NewGuid().GetHashCode()); private float _totalSeconds; [JsonConstructor] From fe2321ce22893fbd03cc1abc74a94e39883cabed Mon Sep 17 00:00:00 2001 From: Mike Parker Date: Thu, 24 Dec 2020 15:37:58 +0000 Subject: [PATCH 2/2] Use Math.Abs on guid hashcode to ensure > 0 --- src/dotnet/MonoGame.Extended.Particles/ParticleEmitter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dotnet/MonoGame.Extended.Particles/ParticleEmitter.cs b/src/dotnet/MonoGame.Extended.Particles/ParticleEmitter.cs index 13b22b44..a7116869 100644 --- a/src/dotnet/MonoGame.Extended.Particles/ParticleEmitter.cs +++ b/src/dotnet/MonoGame.Extended.Particles/ParticleEmitter.cs @@ -11,7 +11,7 @@ namespace MonoGame.Extended.Particles { public unsafe class ParticleEmitter : IDisposable { - private readonly FastRandom _random = new FastRandom(Guid.NewGuid().GetHashCode()); + private readonly FastRandom _random = new FastRandom(Math.Abs(Guid.NewGuid().GetHashCode())); private float _totalSeconds; [JsonConstructor]