Esempio n. 1
0
        public static TimeSeries <T> Define <T>(Interval <T> domain, ulong[] seed)
            where T : struct
        {
            var id  = NextId(ref LastSeriesId);
            var rng = Rng.XOrShift1024(seed);

            if (!States.TryAdd(id, rng))
            {
                throw new Exception($"Key {id} already exists");
            }
            return(new TimeSeries <T>(id, domain, Term(0, gmath.zero <T>())));
        }
Esempio n. 2
0
        void TestBits()
        {
            var bits = Rng.XOrShift1024().ToPolyrand().Bits().Take(Pow2.T16);
            var on   = 0;
            var off  = 0;

            foreach (var bit in bits)
            {
                if (bit)
                {
                    ++on;
                }
                else
                {
                    ++off;
                }
            }
            var onPct  = ((double)on) / ((double)on + (double)off);
            var offPct = ((double)off) / ((double)on + (double)off);

            print($"on = {onPct}, off={offPct}");
        }
Esempio n. 3
0
 public TestContext(ITestConfig config = null, IPolyrand random = null)
     : base(random ?? Rng.XOrShift1024(Seed1024.TestSeed).ToPolyrand())
 {
     this.Config = config ?? TestConfigDefaults.Default();
 }
Esempio n. 4
0
 public AgentContext()
     : base(Rng.XOrShift1024(Seed1024.AppSeed).ToPolyrand())
 {
 }
Esempio n. 5
0
 public void bench_xor1024_uniform_u64()
 {
     Benchmark(Rng.XOrShift1024().PointSource <ulong>());
 }