Exemple #1
0
        public override void SetSeed(ulong[] seed)
        {
            // Don't allow all zero values with this generator.
            if (seed == null || CleromUtil.IsArrayZero(seed))
            {
                SetStartingState();

                // Important to reset base cache
                ResetCache();
            }
            else
            if (seed.Length > 0)
            {
                if (seed.Length == 1)
                {
                    SetStartingState();
                    state0 = seed[0];
                }
                else
                {
                    state0 = seed[0];
                    state1 = seed[1];
                }

                ResetCache();
            }
        }
Exemple #2
0
        public override void SetSeed(ulong[] seed)
        {
            // Don't allow all zero values with this generator.
            if (seed == null || CleromUtil.IsArrayZero(seed))
            {
                SetStartingState();

                // Important to reset base cache
                ResetCache();
            }
            else
            if (seed.Length > 0)
            {
                if (seed.Length < StateSize)
                {
                    SetStartingState();
                    Buffer.BlockCopy(seed, 0, state, 0, seed.Length * sizeof(ulong));
                }
                else
                {
                    Buffer.BlockCopy(seed, 0, state, 0, StateSize * sizeof(ulong));
                }

                stateIdx = 0;
                ResetCache();
            }
        }