예제 #1
0
        public int Seed(string key = null)
        {
            int num;

            if (string.IsNullOrEmpty(key))
            {
                this.last = (this.a * this.last + this.c) % this.m;
                num       = this.last;
            }
            else
            {
                num = this.seed + URandom.GetCode(key);
            }
            return((this.a * num + this.c) % this.m);
        }
예제 #2
0
        public float Value(string key = null)
        {
            int num;

            if (string.IsNullOrEmpty(key))
            {
                this.last = (this.a * this.last + this.c) % this.m;
                num       = this.last;
            }
            else
            {
                num = this.seed + URandom.GetCode(key);
            }
            return(Math.Abs(1f * (float)(this.a * num + this.c) % (float)this.m / (float)this.m));
        }