Exemplo n.º 1
0
        public void TestUniformity_OnUnitCircle()
        {
            var rng = new StatelessRng(kSeed);

            Func <int, float?> distribution = i => {
                Vector2 v = rng.OnUnitCircle(i);
                return(ToAngle01(Mathf.Atan2(v.y, v.x)));
            };

            S.CheckUniformity("theta", Gen(distribution));
        }
Exemplo n.º 2
0
        public void TestForSaltReuse()
        {
            var seen = new HashSet <int>();
            var rng  = new StatelessRng(kSeed);

            StatelessRng.SaltUsed = (salt) => {
                Assert.IsTrue(seen.Add(salt), "Salt {0} is unused", salt);
            };
            try {
                rng.OnUnitCircle(0); seen.Clear();
                rng.InUnitCircle(0); seen.Clear();
                rng.OnUnitSphere(0); seen.Clear();
                rng.InUnitSphere(0); seen.Clear();
                rng.Rotation(0); seen.Clear();
            } finally {
                StatelessRng.SaltUsed = null;
            }
        }