-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework server-side entity spawning (#2093)
- Loading branch information
Showing
49 changed files
with
1,179 additions
and
540 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using NitroxServer.Helper; | ||
|
||
namespace Nitrox.Test.Server.Helper; | ||
|
||
[TestClass] | ||
public class XORRandomTest | ||
{ | ||
[TestMethod] | ||
public void TestMeanGeneration() | ||
{ | ||
// arbitrary values under there but we can't compare the generated values with UnityEngine.Random because it's unaccessible | ||
XORRandom.InitSeed("cheescake".GetHashCode()); | ||
float mean = 0; | ||
int count = 1000000; | ||
for (int i = 0; i < count; i++) | ||
{ | ||
mean += XORRandom.NextFloat(); | ||
} | ||
mean /= count; | ||
Assert.IsTrue(Math.Abs(0.5f - mean) < 0.001f, $"Float number generation isn't uniform enough: {mean}"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.